etcdmain: improve readability

Improve readability of ETCD_CONFIG_FILE env variable parsing part
by adding comments and using flags.FlagToEnv function.

Signed-off-by: Andrey Abramov <st5pub@yandex.ru>
This commit is contained in:
Andrey Abramov 2019-05-26 09:54:26 +03:00
parent 6955331901
commit 14c5eaa7e1

View File

@ -284,8 +284,11 @@ func (cfg *config) parse(arguments []string) error {
var err error
// This env variable must be parsed separately
// because we need to determine whether to use or
// ignore the env variables based on if the config file is set.
if cfg.configFile == "" {
cfg.configFile = os.Getenv("ETCD_CONFIG_FILE")
cfg.configFile = os.Getenv(flags.FlagToEnv("ETCD", "config-file"))
}
if cfg.configFile != "" {