package api import "net/http" // readiness reports listener readiness, not upstream connectivity or authentication. func (s *Server) readiness(w http.ResponseWriter, r *http.Request) { w.Header().Set("Cache-Control", "no-store") s.ops.Lock() defer s.ops.Unlock() proxies, err := s.store.List() ready := err == nil bound := 0 for _, p := range proxies { if !p.HasDestination() { continue } bound++ if !s.manager.Status(p.ID).Running { ready = false } } if !ready || bound == 0 { respond(w, http.StatusServiceUnavailable, map[string]string{"status": "not_ready"}) return } respond(w, http.StatusOK, map[string]string{"status": "ready"}) }