config updated to improve setting values, writing changes and test coverage

This commit is contained in:
bwilliams committed 2026-10-13 13:19:01 +01:00
1 parent 8f0e72821f
commit 169c6c6b64
8 files changed
+453 -59

No files matched your search

+7 -4
View File
@@ -3,6 +3,8 @@ package config
import (
"fmt"
"log/slog"
"maps"
"slices"
)
// PrintTerminal prints the configuration to stdout as String formats it.
@@ -20,8 +22,8 @@ func (conf JobSearchConfig) PrintYaml() {
fmt.Print(conf.YAML() + "\n")
}
// PrintLog logs each configuration key and value at atLevel: debug, warn,
// error, or info for any other level.
// PrintLog logs each configuration key and value, sorted by key, at atLevel:
// debug, warn, error, or info for any other level.
func (conf JobSearchConfig) PrintLog(atLevel slog.Level) {
var logFn func(args ...interface{})
@@ -44,7 +46,8 @@ func (conf JobSearchConfig) PrintLog(atLevel slog.Level) {
}
}
for k, v := range conf.Flatten() {
logFn("\t", k, " = ", v)
flat := conf.Flatten()
for _, k := range slices.Sorted(maps.Keys(flat)) {
logFn("\t", k, " = ", flat[k])
}
}