Change fsnotify to watch config directory instead of file
The fsnotify library suggests watching a directory and checking that the name matches the configuration file.
This commit is contained in:
@@ -117,9 +117,10 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
err = watcher.Add(absConfigPath)
|
||||
configDir := filepath.Dir(absConfigPath)
|
||||
err = watcher.Add(configDir)
|
||||
if err != nil {
|
||||
fmt.Printf("Error adding config path (%s) to watcher: %v. File watching disabled.", absConfigPath, err)
|
||||
fmt.Printf("Error adding config path directory (%s) to watcher: %v. File watching disabled.", configDir, err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user