mirror of
https://github.com/prymitive/karma
synced 2026-05-05 03:16:51 +00:00
Don't set the default value for flags
Let envconfig handle defaults, setting it for flags means that we'll always pass a value to the env if there was a default one, meaning that we're unable to override via env
This commit is contained in:
@@ -77,7 +77,6 @@ func mapEnvConfigToFlags() {
|
||||
}
|
||||
|
||||
envName := f.Tag.Get("envconfig")
|
||||
defaultVal := f.Tag.Get("default")
|
||||
|
||||
helpMsg := fmt.Sprintf("%s. This flag can also be set via %s environment variable.", f.Tag.Get("help"), f.Tag.Get("envconfig"))
|
||||
if f.Tag.Get("required") == "true" {
|
||||
@@ -89,7 +88,7 @@ func mapEnvConfigToFlags() {
|
||||
mapper.isBool = true
|
||||
mapper.boolVal = flag.Bool(flagName, false, helpMsg)
|
||||
} else {
|
||||
mapper.stringVal = flag.String(flagName, defaultVal, helpMsg)
|
||||
mapper.stringVal = flag.String(flagName, "", helpMsg)
|
||||
}
|
||||
flags[envName] = mapper
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user