Improve initial loading

This commit is contained in:
Andrew-71 2024-10-13 16:38:13 +03:00
parent 1f50b8621e
commit acab4bc68b
8 changed files with 47 additions and 44 deletions

View file

@ -38,18 +38,14 @@ func LoadConfig(filename string) error {
return err
}
Cfg = temp_config
slog.Info("Loaded config", "file", filename)
slog.Debug("Loaded config", "file", filename)
return nil
}
func MustLoadConfig() {
err := LoadConfig(DefaultLocation)
func MustLoadConfig(filename string) {
err := LoadConfig(filename)
if err != nil {
slog.Error("error initially loading config", "error", err)
os.Exit(1)
}
}
func init() {
MustLoadConfig()
}
}