diff --git a/viper.go b/viper.go index 7027715..71bc631 100644 --- a/viper.go +++ b/viper.go @@ -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 != "")