1234567891011121314151617181920212223242526272829 |
- package app
- import (
- "net/http"
- "gopkg.in/macaron.v1"
- "gogs.io/gogs/internal/conf"
- "gogs.io/gogs/internal/context"
- )
- func MetricsFilter() macaron.Handler {
- return func(c *context.Context) {
- if !conf.Prometheus.Enabled {
- c.Status(http.StatusNotFound)
- return
- }
- if !conf.Prometheus.EnableBasicAuth {
- return
- }
- c.RequireBasicAuth(conf.Prometheus.BasicAuthUsername, conf.Prometheus.BasicAuthPassword)
- }
- }
|