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:
Benson Wong
2025-07-02 10:22:39 -07:00
parent 1921e570d7
commit 6a058e4191

View File

@@ -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
}