/
githubmirror
/
gogs
Обзор
Документация
Войти
/
githubmirror
/
gogs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
internal/app/metrics.go
29 строк
569 B
ᴊᴏᴇ ᴄʜᴇɴ
all: rename packages ending with "util" to end with "x" (#8182)
16 фев 2026, 21:25
Не верифицирован
16 фев 2026, 21:25
36d56d5
Код
Авторство
О чём код?
package app import ( "net/http" "gopkg.in/macaron.v1" "gogs.io/gogs/internal/authx" "gogs.io/gogs/internal/conf" ) func MetricsFilter() macaron.Handler { return func(w http.ResponseWriter, r *http.Request) { if !conf.Prometheus.Enabled { w.WriteHeader(http.StatusNotFound) return } if !conf.Prometheus.EnableBasicAuth { return } username, password := authx.DecodeBasic(r.Header) if username != conf.Prometheus.BasicAuthUsername || password != conf.Prometheus.BasicAuthPassword { w.WriteHeader(http.StatusForbidden) return } } }