From a802f4d425e88eb79eac0433d117c2732e1aada7 Mon Sep 17 00:00:00 2001 From: Per Abich Date: Fri, 6 Nov 2020 15:22:15 +0100 Subject: [PATCH] Fixing #1019 by replacing all "-" with "_" in the key name when we look up from environment --- viper.go | 2 ++ 1 file changed, 2 insertions(+) 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 != "")