Add config watch to all tools so they are restarted if the config changes
This commit is contained in:
parent
c2a21eabd9
commit
13d019cf62
|
@ -20,7 +20,18 @@ const (
|
|||
|
||||
func main() {
|
||||
// Load the config file
|
||||
pfConfig, _ := config.LoadConfig()
|
||||
pfConfig, configFileProvider := config.LoadConfig()
|
||||
|
||||
// Watch for config changes and re-load config if needed
|
||||
configFileProvider.Watch(func(event interface{}, err error) {
|
||||
if err != nil {
|
||||
log.Printf("Error setting up watch of config : %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Bail on slideshow if there is a config change so it restarts with updated config
|
||||
log.Fatalf("Config file changed! Exiting!")
|
||||
})
|
||||
|
||||
log.Print("========================================")
|
||||
pfConfig.Print()
|
||||
|
|
|
@ -38,18 +38,18 @@ func main() {
|
|||
pfConfig.Print()
|
||||
|
||||
// Watch for config changes and re-load config if needed
|
||||
// configFileProvider.Watch(func(event interface{}, err error) {
|
||||
// if err != nil {
|
||||
// log.Printf("Error setting up watch of config : %s", err)
|
||||
// return
|
||||
// }
|
||||
configFileProvider.Watch(func(event interface{}, err error) {
|
||||
if err != nil {
|
||||
log.Printf("Error setting up watch of config : %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
// // Give the config UI a chance to save and exit clean
|
||||
// time.Sleep(time.Minute)
|
||||
// Give the config UI a chance to save and exit clean
|
||||
time.Sleep(time.Minute)
|
||||
|
||||
// // Bail on slideshow if there is a config change so it restarts with updated config
|
||||
// log.Fatalf("Config file changed! Exiting!")
|
||||
// })
|
||||
// Bail on slideshow if there is a config change so it restarts with updated config
|
||||
log.Fatalf("Config file changed! Exiting!")
|
||||
})
|
||||
|
||||
// Process command line flags
|
||||
if err := pfConfig.Load(posflag.Provider(f, ".", pfConfig), nil); err != nil {
|
||||
|
|
|
@ -18,7 +18,18 @@ const (
|
|||
|
||||
func main() {
|
||||
// Load the config file
|
||||
pfConfig, _ := config.LoadConfig()
|
||||
pfConfig, configFileProvider := config.LoadConfig()
|
||||
|
||||
// Watch for config changes and re-load config if needed
|
||||
configFileProvider.Watch(func(event interface{}, err error) {
|
||||
if err != nil {
|
||||
log.Printf("Error setting up watch of config : %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Bail on slideshow if there is a config change so it restarts with updated config
|
||||
log.Fatalf("Config file changed! Exiting!")
|
||||
})
|
||||
|
||||
PATH_PICTURES := pfConfig.String(config.CONFIG_KEY_ALBUMS_ROOT)
|
||||
|
||||
|
|
Loading…
Reference in a new issue