fix(config): set value when env variable contains string value

This commit is contained in:
kolaente 2025-05-23 12:47:56 +02:00
parent bbf7679dd4
commit 5c17d5b90c
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B
1 changed files with 3 additions and 2 deletions

View File

@ -502,7 +502,8 @@ func setConfigFromEnv() error {
currentMap := configMap
for i, part := range keys {
if i == len(keys)-1 {
_, isString := currentMap[part].(string)
if i == len(keys)-1 || isString {
// Set the value at the final level
currentMap[part] = value
} else {
@ -514,7 +515,7 @@ func setConfigFromEnv() error {
// Move into the nested map
typed, is := currentMap[part].(map[string]any)
if !is {
log.Errorf("Failed to set config value from environment variable %s: %s, failed on part %s, type is not map, is %t", key, value, part, currentMap[part])
log.Errorf("Failed to set config value from environment variable %s: %s, failed on part %s, type is not map, is %T", key, value, part, currentMap[part])
continue
}