From 14c5eaa7e1161140610c8e66bb31c38c11fe66dd Mon Sep 17 00:00:00 2001 From: Andrey Abramov Date: Sun, 26 May 2019 09:54:26 +0300 Subject: [PATCH] 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 --- etcdmain/config.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/etcdmain/config.go b/etcdmain/config.go index a81ecc5dd..b6bd8bbb8 100644 --- a/etcdmain/config.go +++ b/etcdmain/config.go @@ -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 != "" {