fix: 获取hostname的优先级逻辑

pull/198/head
5 years ago
parent c9a539f10c
commit 45943e788c
  1. 8
      pkg/conf/env/env.go

@ -45,8 +45,12 @@ 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)

Loading…
Cancel
Save