check / check (push) Waiting to run
main's tree, with next merged on 26 October, as one commit onto prod, on sneak's order. Model: opus-5-5 Co-authored-by: clawbot <clawbot@noreply.example.org>
20 lines
489 B
Go
20 lines
489 B
Go
package handlers
|
|
|
|
import "net/http"
|
|
|
|
// HandleHealthCheck returns a handler for the health check
|
|
// endpoint. It answers 200 while the status is "ok" and 503 otherwise,
|
|
// so that the image's HEALTHCHECK fails.
|
|
func (s *Handlers) HandleHealthCheck() http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
resp := s.hc.Healthcheck()
|
|
|
|
code := http.StatusOK
|
|
if resp.Status != "ok" {
|
|
code = http.StatusServiceUnavailable
|
|
}
|
|
|
|
s.respondJSON(w, r, resp, code)
|
|
}
|
|
}
|