this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

labeler: add healthcheck endpoint

+17
+1
labeler/service.go
··· 461 461 ctx.Response().WriteHeader(code) 462 462 } 463 463 464 + e.GET("/xrpc/_health", s.HandleHealthCheck) 464 465 if err := s.RegisterHandlersComAtproto(e); err != nil { 465 466 return err 466 467 }
+16
labeler/xrpc_endpoints.go
··· 6 6 7 7 atproto "github.com/bluesky-social/indigo/api/atproto" 8 8 label "github.com/bluesky-social/indigo/api/label" 9 + "github.com/bluesky-social/indigo/version" 9 10 10 11 "github.com/labstack/echo/v4" 11 12 "go.opentelemetry.io/otel" ··· 275 276 } 276 277 return c.JSON(200, out) 277 278 } 279 + 280 + type HealthStatus struct { 281 + Status string `json:"status"` 282 + Version string `json:"version"` 283 + Message string `json:"msg,omitempty"` 284 + } 285 + 286 + func (s *Server) HandleHealthCheck(c echo.Context) error { 287 + if err := s.db.Exec("SELECT 1").Error; err != nil { 288 + log.Errorf("healthcheck can't connect to database: %v", err) 289 + return c.JSON(500, HealthStatus{Status: "error", Version: version.Version, Message: "can't connect to database"}) 290 + } else { 291 + return c.JSON(200, HealthStatus{Status: "ok", Version: version.Version}) 292 + } 293 + }