Make Redis as ENV Var

This commit is contained in:
Phil 2021-12-08 13:11:35 +00:00
parent a522813ffe
commit 876f801e53
No known key found for this signature in database
GPG key ID: 91884FA482AA7CB3
4 changed files with 21 additions and 9 deletions

View file

@ -5,9 +5,10 @@ services:
image: registry.ucode.space/phil/goshorly:latest image: registry.ucode.space/phil/goshorly:latest
environment: environment:
- HOST=example.org # Domain or IP-Adress - HOST=example.org # Domain or IP-Adress
- PORT=3000 # The Port you want to use
- HTTPS=true # If you want to use HTTPS - HTTPS=true # If you want to use HTTPS
- PROXY=true # If you want to use a Reverse Proxy - 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: depends_on:
- redis - redis
restart: always restart: always

View file

@ -5,9 +5,10 @@ services:
image: registry.ucode.space/phil/goshorly:latest image: registry.ucode.space/phil/goshorly:latest
environment: environment:
- HOST=your_domain_or_ip # Domain or IP-Adress - 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 - HTTPS=false # If you want to use HTTPS
- PROXY=false # If you want to use a Reverse Proxy - 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: ports:
- "3000:3000" - "3000:3000"
depends_on: depends_on:

View file

@ -5,14 +5,17 @@ import (
"os" "os"
) )
var HOST string var (
var HTTPS string HOST string
var PROXY bool PORT string
var PORT string HTTPS string
PROXY bool
var URL string URL string
REDIS_URI string
)
func Init_env_vars() { func Init_env_vars() {
UHOST, err := os.LookupEnv("HOST") UHOST, err := os.LookupEnv("HOST")
if !err { if !err {
log.Fatal("HOST enviroment variable not found, please set it!") log.Fatal("HOST enviroment variable not found, please set it!")
@ -40,6 +43,13 @@ func Init_env_vars() {
PORT = UPORT PORT = UPORT
} }
UREDIS_URI, err := os.LookupEnv("REDIS_URI")
if !err {
REDIS_URI = "redis"
} else {
REDIS_URI = UREDIS_URI
}
create_string() create_string()
} }

View file

@ -76,7 +76,7 @@
Made with <a href="https://git.ucode.space/Phil/goshorly"><i class="fas fa-code-branch"></i> Made with <a href="https://git.ucode.space/Phil/goshorly"><i class="fas fa-code-branch"></i>
Phil/goshorly</a> Phil/goshorly</a>
{{ if .GitBuild }} {{ if .GitBuild }}
{{ .GitCommitShort }}/{{ .GitBranch }} | {{ .GitCommitShort }}/{{ .GitBranch }}
{{ end }} {{ end }}
</center> </center>
</footer> </footer>