Configure file watcher to follow links

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-03-19 02:08:28 +01:00
parent 5701c44e73
commit 5bd0ed0b43
Signed by: luzifer
GPG key ID: D91C3E91E4CAD6F5
3 changed files with 13 additions and 6 deletions

2
go.mod
View file

@ -3,7 +3,7 @@ module github.com/Luzifer/go-latestver
go 1.19
require (
github.com/Luzifer/go_helpers/v2 v2.15.3
github.com/Luzifer/go_helpers/v2 v2.16.0
github.com/Luzifer/rconfig/v2 v2.4.0
github.com/antchfx/htmlquery v1.3.0
github.com/antchfx/jsonquery v1.3.2

6
go.sum
View file

@ -1,7 +1,5 @@
github.com/Luzifer/go_helpers/v2 v2.15.2 h1:1L96lhh/E9JKyHoYcBelmjz2pV9qp+u2Ap6fPsfsUrc=
github.com/Luzifer/go_helpers/v2 v2.15.2/go.mod h1:C5EkTBawA4sJt0CHoAoblgGPwTjW9blXZ/Et6RiEu6Q=
github.com/Luzifer/go_helpers/v2 v2.15.3 h1:g7EyKdfftZxEcJmDN3LePVs+QbXU/YqcLlPSMGiZ1Ek=
github.com/Luzifer/go_helpers/v2 v2.15.3/go.mod h1:C5EkTBawA4sJt0CHoAoblgGPwTjW9blXZ/Et6RiEu6Q=
github.com/Luzifer/go_helpers/v2 v2.16.0 h1:Au+q+IJg5eIU7N2tnU6DVl/gHvSWXkN4GmdgzvfsLu0=
github.com/Luzifer/go_helpers/v2 v2.16.0/go.mod h1:C5EkTBawA4sJt0CHoAoblgGPwTjW9blXZ/Et6RiEu6Q=
github.com/Luzifer/rconfig/v2 v2.4.0 h1:MAdymTlExAZ8mx5VG8xOFAtFQSpWBipKYQHPOmYTn9o=
github.com/Luzifer/rconfig/v2 v2.4.0/go.mod h1:hWF3ZVSusbYlg5bEvCwalEyUSY+0JPJWUiIu7rBmav8=
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=

11
main.go
View file

@ -74,7 +74,16 @@ func main() {
}
if cfg.WatchConfig {
fsWatch, err := fileHelper.NewSimpleWatcher(cfg.Config, time.Minute)
fsWatch, err := fileHelper.NewWatcherWithOpts(
cfg.Config,
fileHelper.WatcherOpts{
FollowSymlinks: true,
},
time.Minute,
fileHelper.WatcherCheckPresence,
fileHelper.WatcherCheckSize,
fileHelper.WatcherCheckMtime,
)
if err != nil {
log.WithError(err).Fatal("creating config file watcher")
}