correct config order

This commit is contained in:
Paolo Asperti 2021-12-09 17:47:43 +01:00
parent 14deeca57a
commit 6f70a6aab3
Signed by: paspo
GPG Key ID: 06D46905D19D5182

View File

@ -18,10 +18,10 @@ func init() {
if err != nil { // Handle errors reading the config file if err != nil { // Handle errors reading the config file
syslog.Err(fmt.Sprintf("Can't read config file: %s \n", err.Error())) syslog.Err(fmt.Sprintf("Can't read config file: %s \n", err.Error()))
} }
viper.WatchConfig()
viper.OnConfigChange(func(e fsnotify.Event) { viper.OnConfigChange(func(e fsnotify.Event) {
//The Viper configuration has changed to perform the responding operation //The Viper configuration has changed to perform the responding operation
fmt.Println("Config file changed:", e.Name) fmt.Println("Config file changed:", e.Name)
events.FireEvent("config_changed") events.FireEvent("config_changed")
}) })
viper.WatchConfig()
} }