3
0

Optimize hostname detection

When corteza is running inside docker container
HOSTNAME env var is set to container ID and this effectively
misconfigures URLs and domain names.

HOSTNAME and HOST are now removed and default hostname is now
'localhost' (no longer 'local.cortezaproject.org')
This commit is contained in:
Denis Arh
2022-08-04 15:17:30 +02:00
parent 75b7d78eac
commit 8ec05a032c
+2 -5
View File
@@ -70,13 +70,10 @@ func GuessWebappHostname() string {
}
func guessHostname(base ...string) string {
// All env keys we'll check, first that has any value set, will be used as hostname
// All env keys we'll check, first one with a value set, will be used as hostname
candidates := append(base, []string{
os.Getenv("LETSENCRYPT_HOST"),
os.Getenv("VIRTUAL_HOST"),
os.Getenv("HOSTNAME"),
os.Getenv("HOST"),
}...)
for _, host := range candidates {
@@ -85,7 +82,7 @@ func guessHostname(base ...string) string {
}
}
return "local.cortezaproject.org"
return "localhost"
}
// returns path prefix