cic-chain-events/cmd/service/api.go

27 lines
467 B
Go
Raw Permalink Normal View History

package main
import (
"github.com/VictoriaMetrics/metrics"
"github.com/labstack/echo/v4"
2023-03-13 15:30:55 +01:00
echopprof "github.com/sevenNt/echo-pprof"
)
func initApiServer() *echo.Echo {
server := echo.New()
server.HideBanner = true
server.HidePort = true
if ko.Bool("metrics.go_process") {
server.GET("/metrics", func(c echo.Context) error {
metrics.WritePrometheus(c.Response(), true)
return nil
})
}
2023-03-13 15:30:55 +01:00
if debugFlag {
echopprof.Wrap(server)
}
return server
}