Implement health check for deploy. Make version endpoint to return revision if not set
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"go.uber.org/fx"
|
||||
|
||||
"payouts/internal/api/health"
|
||||
"payouts/internal/api/payout"
|
||||
"payouts/internal/api/user"
|
||||
"payouts/internal/api/version"
|
||||
@@ -21,6 +22,7 @@ import (
|
||||
// Module is a fx module
|
||||
var Module = fx.Options(
|
||||
user.Module,
|
||||
health.Module,
|
||||
payout.Module,
|
||||
version.Module,
|
||||
monitoring.Module,
|
||||
@@ -40,6 +42,7 @@ type Params struct {
|
||||
PayoutHandler payout.Handler
|
||||
UserHandler user.Handler
|
||||
Version version.Handler
|
||||
HealthHandler health.Handler
|
||||
|
||||
Metrics monitoring.Metrics
|
||||
}
|
||||
@@ -50,7 +53,10 @@ func RegisterRoutes(p Params, lc fx.Lifecycle) {
|
||||
router := mux.NewRouter()
|
||||
router.StrictSlash(true)
|
||||
|
||||
// Version endpoint
|
||||
router.HandleFunc(version.Route, p.Version.VersionHandler).Methods(http.MethodGet)
|
||||
// Health check endpoint
|
||||
router.HandleFunc(health.Route, p.HealthHandler.Health).Methods(http.MethodGet)
|
||||
|
||||
if p.AppConfig.Server.EnablePProfEndpoints {
|
||||
router.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
|
||||
|
||||
Reference in New Issue
Block a user