mirror of
https://github.com/prymitive/karma
synced 2026-05-05 03:16:51 +00:00
Merge pull request #1364 from prymitive/uri-errors
fix(backend): mask credentials in error logs
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/prymitive/karma/internal/config"
|
||||
"github.com/prymitive/karma/internal/models"
|
||||
"github.com/prymitive/karma/internal/transform"
|
||||
"github.com/prymitive/karma/internal/uri"
|
||||
|
||||
"github.com/DeanThompson/ginpprof"
|
||||
"github.com/gin-contrib/cors"
|
||||
@@ -125,7 +126,7 @@ func setupUpstreams() {
|
||||
if s.TLS.CA != "" || s.TLS.Cert != "" || s.TLS.InsecureSkipVerify {
|
||||
httpTransport, err = alertmanager.NewHTTPTransport(s.TLS.CA, s.TLS.Cert, s.TLS.Key, s.TLS.InsecureSkipVerify)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create HTTP transport for Alertmanager '%s' with URI '%s': %s", s.Name, s.URI, err)
|
||||
log.Fatalf("Failed to create HTTP transport for Alertmanager '%s' with URI '%s': %s", s.Name, uri.SanitizeURI(s.URI), err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,11 +140,11 @@ func setupUpstreams() {
|
||||
alertmanager.WithHTTPHeaders(s.Headers),
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create Alertmanager '%s' with URI '%s': %s", s.Name, s.URI, err)
|
||||
log.Fatalf("Failed to create Alertmanager '%s' with URI '%s': %s", s.Name, uri.SanitizeURI(s.URI), err)
|
||||
}
|
||||
err = alertmanager.RegisterAlertmanager(am)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to register Alertmanager '%s' with URI '%s': %s", s.Name, s.URI, err)
|
||||
log.Fatalf("Failed to register Alertmanager '%s' with URI '%s': %s", s.Name, uri.SanitizeURI(s.URI), err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ func RegisterAlertmanager(am *Alertmanager) error {
|
||||
|
||||
for _, existingAM := range upstreams {
|
||||
if existingAM.URI == am.URI {
|
||||
return fmt.Errorf("alertmanager upstream '%s' already collects from '%s'", existingAM.Name, existingAM.URI)
|
||||
return fmt.Errorf("alertmanager upstream '%s' already collects from '%s'", existingAM.Name, uri.SanitizeURI(existingAM.URI))
|
||||
}
|
||||
}
|
||||
upstreams[am.Name] = am
|
||||
log.Infof("[%s] Configured Alertmanager source at %s (proxied: %v)", am.Name, am.URI, am.ProxyRequests)
|
||||
log.Infof("[%s] Configured Alertmanager source at %s (proxied: %v)", am.Name, uri.SanitizeURI(am.URI), am.ProxyRequests)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user