Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internals/config/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func Normalize(config *configutils.Config, path string, structure any) {
// Load temporary config back into paths
config.Layer.Delete(path)

config.Load(tmpConf.Layer.All(), path)
config.Load(tmpConf.Layer.Get("").(map[string]any), path)
}

func InitReload() {
Expand Down
10 changes: 6 additions & 4 deletions internals/config/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,21 @@ func LoadTokens() {
}

func NormalizeTokens() {
configArray := []map[string]any{}
data := []map[string]any{}

for _, config := range tokenConf.Layer.Slices("tokenconfigs") {
tmpConf := configutils.New()
tmpConf.Load(config.All(), "")
tmpConf.Load(config.Get("").(map[string]any), "")

Normalize(tmpConf, "overrides", &structure.SETTINGS{})

configArray = append(configArray, tmpConf.Layer.All())
data = append(data, tmpConf.Layer.Get("").(map[string]any))
}

// Merge token configs together into new temporary config
tokenConf.Layer.Set("tokenconfigs", configArray)
tokenConf.Load(map[string]any{
"tokenconfigs": data,
}, "")
}

func InitTokens() {
Expand Down
12 changes: 9 additions & 3 deletions utils/configutils/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,14 @@ func applyTransform(key string, value any, transformTargets map[string]Transform

childKey, childValue := applyTransform(fullKey, v, targets, funcs)

res[childKey] = childValue
keyParts := getKeyParts(childKey)

res[keyParts[len(keyParts)-1]] = childValue
}

return newKey, res
keyParts := getKeyParts(newKey)

return keyParts[len(keyParts)-1], res
case []any:
res := []any{}

Expand All @@ -166,7 +170,9 @@ func applyTransform(key string, value any, transformTargets map[string]Transform
res = append(res, childValue)
}

return newKey, res
keyParts := getKeyParts(newKey)

return keyParts[len(keyParts)-1], res
default:
return applyTransformToAny(key, asserted, transformTargets, funcs)
}
Expand Down
4 changes: 2 additions & 2 deletions utils/request/requestkeys/requestkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ var BodyPrefix = "@"
var HeaderPrefix = "#"

func Parse(str string) Field {
prefix := str[1:]
key := str[:1]
prefix := str[:1]
key := str[1:]

return Field{
Prefix: prefix,
Expand Down