printLoadedConf modified to only print explicitly set config values (via env or config file)
This commit is contained in:
1 parent
d6688a6754
commit
803a8929e6
3 files changed
+122
-7
No files matched your search
@@ -24,17 +24,21 @@ func printEnv() {
|
||||
}
|
||||
}
|
||||
|
||||
// printLoadedConfig logs every key Viper has loaded, with its value and type,
|
||||
// at debug level.
|
||||
// printLoadedConfig logs every key set by the config file or an environment
|
||||
// variable (see isExplicitlySet), with its value and type, at debug level.
|
||||
func printLoadedConfig() {
|
||||
slog.Debug("Loaded config:")
|
||||
keys := viper.AllKeys()
|
||||
for i := range keys {
|
||||
k := keys[i]
|
||||
v := viper.Get(k)
|
||||
t := reflect.TypeOf(v)
|
||||
slog.Debug(
|
||||
"\t" + k + " = " + fmt.Sprintf("%#v", v) + " <" + t.Kind().String() + ">")
|
||||
if isExplicitlySet(k) {
|
||||
v := viper.Get(k)
|
||||
t := reflect.TypeOf(v)
|
||||
slog.Debug(
|
||||
"\t" + k + " = " + fmt.Sprintf("%#v", v) +
|
||||
" <" + t.Kind().String() + ">",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user