mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
move metrics to /metrics.
This commit is contained in:
parent
6deaa64884
commit
ef7e9b1a53
@ -5,8 +5,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
||||||
|
|
||||||
"gitlab.com/demodesk/neko/server/internal/api/members"
|
"gitlab.com/demodesk/neko/server/internal/api/members"
|
||||||
"gitlab.com/demodesk/neko/server/internal/api/room"
|
"gitlab.com/demodesk/neko/server/internal/api/room"
|
||||||
"gitlab.com/demodesk/neko/server/pkg/auth"
|
"gitlab.com/demodesk/neko/server/pkg/auth"
|
||||||
@ -64,11 +62,6 @@ func (api *ApiManagerCtx) Route(r types.Router) {
|
|||||||
_, err := w.Write([]byte("true"))
|
_, err := w.Write([]byte("true"))
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
||||||
r.Get("/metrics", func(w http.ResponseWriter, r *http.Request) error {
|
|
||||||
promhttp.Handler().ServeHTTP(w, r)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *ApiManagerCtx) Authenticate(w http.ResponseWriter, r *http.Request) (context.Context, error) {
|
func (api *ApiManagerCtx) Authenticate(w http.ResponseWriter, r *http.Request) (context.Context, error) {
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/go-chi/cors"
|
"github.com/go-chi/cors"
|
||||||
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
@ -41,6 +42,11 @@ func New(WebSocketManager types.WebSocketManager, ApiManager types.ApiManager, c
|
|||||||
return config.AllowOrigin(r.Header.Get("Origin"))
|
return config.AllowOrigin(r.Header.Get("Origin"))
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
router.Get("/metrics", func(w http.ResponseWriter, r *http.Request) error {
|
||||||
|
promhttp.Handler().ServeHTTP(w, r)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
if config.Static != "" {
|
if config.Static != "" {
|
||||||
fs := http.FileServer(http.Dir(config.Static))
|
fs := http.FileServer(http.Dir(config.Static))
|
||||||
router.Get("/*", func(w http.ResponseWriter, r *http.Request) error {
|
router.Get("/*", func(w http.ResponseWriter, r *http.Request) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user