From c70c83f74593c1ed75c2195e2dba74a5dfcd30cc Mon Sep 17 00:00:00 2001 From: James Elliott Date: Tue, 5 Mar 2024 19:53:02 +1100 Subject: fix(configuration): warning about log level env (#6784) The AUTHELIA_LOG_LEVEL env variable is incorrectly detected as the deprecated version which maps to the `log_level` key instead of the `log.level` key. Signed-off-by: James Elliott --- internal/configuration/helpers.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'internal/configuration/helpers.go') diff --git a/internal/configuration/helpers.go b/internal/configuration/helpers.go index db4450727..a65f69911 100644 --- a/internal/configuration/helpers.go +++ b/internal/configuration/helpers.go @@ -11,9 +11,7 @@ func getEnvConfigMap(keys []string, prefix, delimiter string, ds map[string]Depr keyMap = make(map[string]string) for _, key := range keys { - if strings.Contains(key, delimiter) { - keyMap[ToEnvironmentKey(key, prefix, delimiter)] = key - } + keyMap[ToEnvironmentKey(key, prefix, delimiter)] = key // Secret envs should be ignored by the env parser. if IsSecretKey(key) { @@ -32,7 +30,13 @@ func getEnvConfigMap(keys []string, prefix, delimiter string, ds map[string]Depr continue } - keyMap[ToEnvironmentKey(deprecation.Key, prefix, delimiter)] = deprecation.Key + d := ToEnvironmentKey(deprecation.Key, prefix, delimiter) + + if _, ok := keyMap[d]; ok { + continue + } + + keyMap[d] = deprecation.Key } return keyMap, ignoredKeys -- cgit v1.2.3