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

@ -14,7 +14,7 @@ type SentryRequest struct {
}
func (ws *WebServer) APISentryProxy(rw http.ResponseWriter, r *http.Request) {
if !config.G.ErrorReporting.Enabled {
if !config.Get().ErrorReporting.Enabled {
ws.log.Debug("error reporting disabled")
rw.WriteHeader(http.StatusBadRequest)
return
@ -37,8 +37,8 @@ func (ws *WebServer) APISentryProxy(rw http.ResponseWriter, r *http.Request) {
rw.WriteHeader(http.StatusBadRequest)
return
}
if sd.DSN != config.G.ErrorReporting.DSN {
ws.log.WithField("have", sd.DSN).WithField("expected", config.G.ErrorReporting.DSN).Debug("invalid DSN")
if sd.DSN != config.Get().ErrorReporting.DSN {
ws.log.WithField("have", sd.DSN).WithField("expected", config.Get().ErrorReporting.DSN).Debug("invalid DSN")
rw.WriteHeader(http.StatusBadRequest)
return
}