From 6553cbadd4a55de7dea32b53162b5886eab0c296 Mon Sep 17 00:00:00 2001 From: Akshat Rustagi Date: Thu, 30 Jan 2020 12:43:23 +0530 Subject: [PATCH] Replaced "-" character with "_" when reading from environment variables. --- source/env.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/env.go b/source/env.go index d595a9d63..821a425f4 100644 --- a/source/env.go +++ b/source/env.go @@ -17,7 +17,9 @@ type EnvSource struct { // format. Periods are replaced with single underscores. Note that reversing // this would generally be ambiguous as underscores are common in variable keys. func envamize(key string) string { - return strings.Replace(strings.ToUpper(key), ".", "_", -1) + key = strings.ReplaceAll(key, "-", "_") + key = strings.ReplaceAll(key, ".", "_") + return strings.ToUpper(key) } func NewEnvSource() *EnvSource {