add metrics to config.

This commit is contained in:
Miroslav Šedivý
2022-07-04 18:26:29 +02:00
parent bf47e5a8d0
commit 2bf83f6217
2 changed files with 19 additions and 10 deletions

View File

@ -47,10 +47,12 @@ func New(WebSocketManager types.WebSocketManager, ApiManager types.ApiManager, c
return err
})
router.Get("/metrics", func(w http.ResponseWriter, r *http.Request) error {
promhttp.Handler().ServeHTTP(w, r)
return nil
})
if config.Metrics {
router.Get("/metrics", func(w http.ResponseWriter, r *http.Request) error {
promhttp.Handler().ServeHTTP(w, r)
return nil
})
}
if config.Static != "" {
fs := http.FileServer(http.Dir(config.Static))