From 32424bf8c5f0abc7199689d82794e30d85d3abbd Mon Sep 17 00:00:00 2001 From: James Elliott Date: Sat, 16 Mar 2024 22:50:40 +1100 Subject: fix(configuration): include more helpful address mapping logs (#6909) This includes more helpful address mapping logs which actually show the value automatically mapped so users can update and debug easier. Signed-off-by: James Elliott --- internal/configuration/helpers.go | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'internal/configuration/helpers.go') diff --git a/internal/configuration/helpers.go b/internal/configuration/helpers.go index a65f69911..bd3e9f291 100644 --- a/internal/configuration/helpers.go +++ b/internal/configuration/helpers.go @@ -7,7 +7,7 @@ import ( "github.com/authelia/authelia/v4/internal/utils" ) -func getEnvConfigMap(keys []string, prefix, delimiter string, ds map[string]Deprecation) (keyMap map[string]string, ignoredKeys []string) { +func getEnvConfigMap(keys []string, prefix, delimiter string, ds map[string]Deprecation, dms []MultiKeyMappedDeprecation) (keyMap map[string]string, ignoredKeys []string) { keyMap = make(map[string]string) for _, key := range keys { @@ -19,13 +19,11 @@ func getEnvConfigMap(keys []string, prefix, delimiter string, ds map[string]Depr } } - for key := range ds { + for key, deprecation := range ds { if IsSecretKey(key) { ignoredKeys = append(ignoredKeys, ToEnvironmentSecretKey(key, prefix, delimiter)) } - } - for _, deprecation := range deprecations { if !deprecation.AutoMap { continue } @@ -39,6 +37,22 @@ func getEnvConfigMap(keys []string, prefix, delimiter string, ds map[string]Depr keyMap[d] = deprecation.Key } + for _, deprecation := range dms { + for _, key := range deprecation.Keys { + if IsSecretKey(key) { + ignoredKeys = append(ignoredKeys, ToEnvironmentSecretKey(key, prefix, delimiter)) + } + + d := ToEnvironmentKey(key, prefix, delimiter) + + if _, ok := keyMap[d]; ok { + continue + } + + keyMap[d] = key + } + } + return keyMap, ignoredKeys } -- cgit v1.2.3