mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
pkg: handle version env variable
Version flag is meant for displaying version and it's a boolean. It's for an internal use, and we may not want users to set it in the environment. Fixes # 11210
This commit is contained in:
parent
a6a1fdd457
commit
27535517b1
@ -316,6 +316,13 @@ func (cfg *config) parse(arguments []string) error {
|
||||
}
|
||||
|
||||
func (cfg *config) configFromCmdLine() error {
|
||||
verKey := "ETCD_VERSION"
|
||||
if verVal := os.Getenv(verKey); verVal != "" {
|
||||
// unset to avoid any possible side-effect.
|
||||
os.Unsetenv(verKey)
|
||||
plog.Warningf("cannot set special environment variable %s=%s", verKey, verVal)
|
||||
}
|
||||
|
||||
err := flags.SetFlagsFromEnv("ETCD", cfg.cf.flagSet)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
x
Reference in New Issue
Block a user