diff --git a/pkg/conf/env/env.go b/pkg/conf/env/env.go index 54b867e6d..64c4a963a 100644 --- a/pkg/conf/env/env.go +++ b/pkg/conf/env/env.go @@ -45,10 +45,13 @@ var ( func init() { var err error - if Hostname, err = os.Hostname(); err != nil || Hostname == "" { - Hostname = os.Getenv("HOSTNAME") + Hostname = os.Getenv("HOSTNAME") + if Hostname == "" { + Hostname, err = os.Hostname() + if err != nil { + Hostname = "" + } } - addFlag(flag.CommandLine) }