internal: walk config in go, check, parse and load from scheme like in python

closes #2719

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2022-07-26 11:33:35 +02:00
parent d08856c1fe
commit 10b48b27b0
10 changed files with 149 additions and 47 deletions

View File

@ -37,7 +37,7 @@ func RunMetricsServer() {
l.WithError(err).Warning("failed to get upstream metrics")
return
}
re.SetBasicAuth("monitor", config.G.SecretKey)
re.SetBasicAuth("monitor", config.Get().SecretKey)
res, err := http.DefaultClient.Do(re)
if err != nil {
l.WithError(err).Warning("failed to get upstream metrics")
@ -54,10 +54,10 @@ func RunMetricsServer() {
return
}
})
l.WithField("listen", config.G.Web.ListenMetrics).Info("Starting Metrics server")
err := http.ListenAndServe(config.G.Web.ListenMetrics, m)
l.WithField("listen", config.Get().Web.ListenMetrics).Info("Starting Metrics server")
err := http.ListenAndServe(config.Get().Web.ListenMetrics, m)
if err != nil {
l.WithError(err).Warning("Failed to start metrics server")
}
l.WithField("listen", config.G.Web.ListenMetrics).Info("Stopping Metrics server")
l.WithField("listen", config.Get().Web.ListenMetrics).Info("Stopping Metrics server")
}