Allow to disable filesystem watcher

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-03-18 15:29:16 +01:00
parent 7838e8e037
commit d3261d7434
Signed by: luzifer
GPG key ID: D91C3E91E4CAD6F5

View file

@ -28,6 +28,7 @@ var (
Storage string `flag:"storage" default:"sqlite" description:"Storage adapter to use (mysql, sqlite)"`
StorageDSN string `flag:"storage-dsn" default:"file::memory:?cache=shared" description:"DSN to connect to the database"`
VersionAndExit bool `flag:"version" default:"false" description:"Prints current version and exits"`
WatchConfig bool `flag:"watch-config" default:"true" description:"Whether to watch the config file for changes"`
}{}
configFile = config.New()
@ -68,11 +69,13 @@ func main() {
log.WithError(err).Fatal("Configuration is not valid")
}
if cfg.WatchConfig {
fsWatch, err := fileHelper.NewSimpleWatcher(cfg.Config, time.Minute)
if err != nil {
log.WithError(err).Fatal("creating config file watcher")
}
go reloadConfigOnChange(fsWatch)
}
storage, err = database.NewClient(cfg.Storage, cfg.StorageDSN)
if err != nil {