From d3ef1583608aeeb87f4edb29f7182d4ef32ff323 Mon Sep 17 00:00:00 2001 From: Marc 'risson' Schmitt Date: Sat, 29 Apr 2023 01:30:56 +0200 Subject: [PATCH] root: restart gunicorn on configuration changes Signed-off-by: Marc 'risson' Schmitt --- cmd/server/server.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/server/server.go b/cmd/server/server.go index e81b97c22..a0759585f 100644 --- a/cmd/server/server.go +++ b/cmd/server/server.go @@ -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