use env for flags wtih dot in name (#4415)

This commit is contained in:
SmsS4 2023-04-20 20:03:27 +03:30 committed by GitHub
parent 9f55c7c90e
commit 4131874fa8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1059,11 +1059,13 @@ func (f *FlagSet) ParseEnv(environ []string) error {
}
envKey := strings.ToUpper(flag.Name)
if f.envPrefix != "" {
envKey = f.envPrefix + "_" + envKey
}
envKey = strings.Replace(envKey, "-", "_", -1)
envKey = strings.Replace(envKey, ".", "_", -1)
value, isSet := env[envKey]
if !isSet {
continue