root: restart gunicorn on configuration changes

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt 2023-04-29 01:30:56 +02:00
parent 969ec188a7
commit d3ef158360
No known key found for this signature in database
GPG Key ID: 9C3FA22FABF1AA8D
1 changed files with 11 additions and 0 deletions

View File

@ -97,6 +97,17 @@ var rootCmd = &cobra.Command{
}
go web.RunMetricsServer()
go attemptStartBackend(g)
w, err := config.WatchChanges(func() {
g.Restart()
})
if err != nil {
l.WithError(err).Warning("failed to start watching for configuration changes, no automatic update will be done")
}
if w != nil {
defer w.Close()
}
ws.Start()
<-ex
running = false