/* Copyright © 2026 Craig Williams This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ package config import ( "fmt" "log/slog" "os" "reflect" "slices" "strings" "github.com/spf13/viper" ) // Debug: Prints detected environment variables func printEnv() { slog.Debug("Environment:") env := os.Environ() slices.Sort(env) for _, e := range env { pair := strings.SplitN(e, "=", 2) if strings.HasPrefix(pair[0], EnvPrefix) { slog.Debug("\t" + pair[0] + "=" + pair[1]) } } } // Debug: Prints loaded configuration 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() + ">") } } // Debug: Prints parsed configuration func printConfig(conf JobSearchConfig) { slog.Debug("Config:") conf.PrintLog(slog.LevelDebug) }