summaryrefslogtreecommitdiff
path: root/internal/configuration/helpers.go
diff options
context:
space:
mode:
authorJames Elliott <james-d-elliott@users.noreply.github.com>2024-03-16 22:50:40 +1100
committerGitHub <noreply@github.com>2024-03-16 22:50:40 +1100
commit32424bf8c5f0abc7199689d82794e30d85d3abbd (patch)
tree5a9577b70ed33acec936dd028d657c24af3269b0 /internal/configuration/helpers.go
parent438e433e5b211512954f3c6ae5255269883f65e3 (diff)
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 <james-d-elliott@users.noreply.github.com>
Diffstat (limited to 'internal/configuration/helpers.go')
-rw-r--r--internal/configuration/helpers.go22
1 files changed, 18 insertions, 4 deletions
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
}