mirror of
https://github.com/go-kratos/kratos.git
synced 2025-03-17 21:07:54 +02:00
fix: 获取hostname的优先级逻辑
This commit is contained in:
parent
c9a539f10c
commit
45943e788c
8
pkg/conf/env/env.go
vendored
8
pkg/conf/env/env.go
vendored
@ -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…
x
Reference in New Issue
Block a user