|
|
@ -5,6 +5,8 @@ package env |
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"flag" |
|
|
|
"flag" |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
|
|
|
|
"strconv" |
|
|
|
|
|
|
|
"time" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// deploy env.
|
|
|
|
// deploy env.
|
|
|
@ -45,10 +47,13 @@ var ( |
|
|
|
|
|
|
|
|
|
|
|
func init() { |
|
|
|
func init() { |
|
|
|
var err error |
|
|
|
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 = strconv.Itoa(int(time.Now().UnixNano())) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
addFlag(flag.CommandLine) |
|
|
|
addFlag(flag.CommandLine) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|