Warn when Koanf read fails #47

Merged
Elara6331 merged 3 commits from Hunman/itd:error-handling into master 2023-01-02 09:05:24 +00:00
Showing only changes of commit 82bb145cbc - Show all commits

View File

@ -16,6 +16,8 @@ import (
var cfgDir string var cfgDir string
func init() { func init() {
etcPath := "/etc/itd.toml";
// Set up logger // Set up logger
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}) log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
@ -52,7 +54,7 @@ func init() {
setCfgDefaults() setCfgDefaults()
// Load config files // Load config files
etcProvider := file.Provider("/etc/itd.toml") etcProvider := file.Provider(etcPath)
cfgProvider := file.Provider(cfgPath) cfgProvider := file.Provider(cfgPath)
k.Load(etcProvider, toml.Parser()) k.Load(etcProvider, toml.Parser())
k.Load(cfgProvider, toml.Parser()) k.Load(cfgProvider, toml.Parser())