fix: 获取hostname的优先级逻辑

pull/201/head
开发者小蓝 5 years ago committed by GitHub
parent 090d749dc4
commit a0828a265f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      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")
if Hostname == "" {
Hostname, err = os.Hostname()
if err != nil {
Hostname = ""
}
}
addFlag(flag.CommandLine)
}

Loading…
Cancel
Save