mirror of
https://github.com/spf13/viper
synced 2025-05-11 06:37:27 +00:00
Fixing #1019 by replacing all "-" with "_" in the key name when we look up from environment
This commit is contained in:
parent
493643fd5e
commit
a802f4d425
1 changed files with 2 additions and 0 deletions
2
viper.go
2
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 != "")
|
||||
|
|
Loading…
Add table
Reference in a new issue