Fix formatting and remove enabled toggle

This commit is contained in:
Bob Shannon
2018-11-14 17:37:32 -05:00
parent 362b3740ed
commit dcc48860b8
4 changed files with 8 additions and 13 deletions
+5 -5
View File
@@ -246,11 +246,11 @@ func (hs *HTTPServer) metricsEndpoint(ctx *macaron.Context) {
return
}
if hs.Cfg.MetricsEndpointBasicAuthEnabled {
if !util.BasicAuthenticatedRequest(ctx.Req, hs.Cfg.MetricsEndpointBasicAuthUsername, hs.Cfg.MetricsEndpointBasicAuthPassword) {
ctx.Resp.WriteHeader(http.StatusUnauthorized)
return
}
if hs.Cfg.MetricsEndpointBasicAuthUsername != "" &&
hs.Cfg.MetricsEndpointBasicAuthPassword != "" &&
!util.BasicAuthenticatedRequest(ctx.Req, hs.Cfg.MetricsEndpointBasicAuthUsername, hs.Cfg.MetricsEndpointBasicAuthPassword) {
ctx.Resp.WriteHeader(http.StatusUnauthorized)
return
}
promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{}).