mirror of
https://github.com/hanzo-fi/webhooks.git
synced 2026-10-30 20:32:55 +00:00
28 lines
509 B
Go
28 lines
509 B
Go
package worker
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
|
|
"github.com/formancehq/go-libs/v2/service"
|
|
|
|
"github.com/formancehq/go-libs/v2/logging"
|
|
)
|
|
|
|
const (
|
|
PathHealthCheck = "/_healthcheck"
|
|
)
|
|
|
|
func NewWorkerHandler(debug bool) http.Handler {
|
|
h := chi.NewRouter()
|
|
h.Use(service.OTLPMiddleware("webhooks", debug))
|
|
h.Get(PathHealthCheck, healthCheckHandle)
|
|
|
|
return h
|
|
}
|
|
|
|
func healthCheckHandle(_ http.ResponseWriter, r *http.Request) {
|
|
logging.FromContext(r.Context()).Infof("health check OK")
|
|
}
|