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) } }