Fixing #1019 by replacing all "-" with "_" in the key name when we look up from environment

This commit is contained in:
Per Abich 2020-11-06 15:22:15 +01:00
parent 493643fd5e
commit a802f4d425

View file

@ -457,6 +457,8 @@ func (v *Viper) getEnv(key string) (string, bool) {
key = v.envKeyReplacer.Replace(key)
}
key = strings.ReplaceAll(key, "-", "_")
val, ok := os.LookupEnv(key)
return val, ok && (v.allowEmptyEnv || val != "")