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>
This commit was merged in pull request #198.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user