Make Redis as ENV Var
This commit is contained in:
parent
a522813ffe
commit
876f801e53
4 changed files with 21 additions and 9 deletions
|
@ -5,9 +5,10 @@ services:
|
|||
image: registry.ucode.space/phil/goshorly:latest
|
||||
environment:
|
||||
- HOST=example.org # Domain or IP-Adress
|
||||
- PORT=3000 # The Port you want to use
|
||||
- HTTPS=true # If you want to use HTTPS
|
||||
- PROXY=true # If you want to use a Reverse Proxy
|
||||
- PORT=3000 # The Port you want to use
|
||||
- REDIS_URI=redis # The Redis-URI (name of redis container OOTB)
|
||||
depends_on:
|
||||
- redis
|
||||
restart: always
|
||||
|
|
|
@ -5,9 +5,10 @@ services:
|
|||
image: registry.ucode.space/phil/goshorly:latest
|
||||
environment:
|
||||
- HOST=your_domain_or_ip # Domain or IP-Adress
|
||||
- PORT=3000 # The Port you want to use
|
||||
- HTTPS=false # If you want to use HTTPS
|
||||
- PROXY=false # If you want to use a Reverse Proxy
|
||||
- PORT=3000 # The Port you want to use
|
||||
- REDIS_URI=redis # The Redis-URI (name of redis container OOTB)
|
||||
ports:
|
||||
- "3000:3000"
|
||||
depends_on:
|
||||
|
|
22
utils/env.go
22
utils/env.go
|
@ -5,14 +5,17 @@ import (
|
|||
"os"
|
||||
)
|
||||
|
||||
var HOST string
|
||||
var HTTPS string
|
||||
var PROXY bool
|
||||
var PORT string
|
||||
|
||||
var URL string
|
||||
var (
|
||||
HOST string
|
||||
PORT string
|
||||
HTTPS string
|
||||
PROXY bool
|
||||
URL string
|
||||
REDIS_URI string
|
||||
)
|
||||
|
||||
func Init_env_vars() {
|
||||
|
||||
UHOST, err := os.LookupEnv("HOST")
|
||||
if !err {
|
||||
log.Fatal("HOST enviroment variable not found, please set it!")
|
||||
|
@ -40,6 +43,13 @@ func Init_env_vars() {
|
|||
PORT = UPORT
|
||||
}
|
||||
|
||||
UREDIS_URI, err := os.LookupEnv("REDIS_URI")
|
||||
if !err {
|
||||
REDIS_URI = "redis"
|
||||
} else {
|
||||
REDIS_URI = UREDIS_URI
|
||||
}
|
||||
|
||||
create_string()
|
||||
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
Made with <a href="https://git.ucode.space/Phil/goshorly"><i class="fas fa-code-branch"></i>
|
||||
Phil/goshorly</a>
|
||||
{{ if .GitBuild }}
|
||||
{{ .GitCommitShort }}/{{ .GitBranch }}
|
||||
| {{ .GitCommitShort }}/{{ .GitBranch }}
|
||||
{{ end }}
|
||||
</center>
|
||||
</footer>
|
||||
|
|
Loading…
Reference in a new issue