From 8ec05a032ca41323316bd076106708495b0a3322 Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Thu, 4 Aug 2022 15:17:30 +0200 Subject: [PATCH] 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') --- pkg/options/helpers.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/options/helpers.go b/pkg/options/helpers.go index af8b9a040..8bdd30c5a 100644 --- a/pkg/options/helpers.go +++ b/pkg/options/helpers.go @@ -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