Skip to content

Commit

Permalink
feat: add morty controller endpoint to healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyLARDENOIS authored and sylvain-reynaud committed Apr 26, 2023
1 parent a68d651 commit af7d4a5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/gateway/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,22 @@ const (

func (s *Server) HealthcheckHandler(w http.ResponseWriter, _ *http.Request) {

// check is morty is up
// check is morty registry is up
_, err := http.Get(s.cfg.MortyRegistryEndpoint + "/healthz")
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
json.NewEncoder(w).Encode(&healthcheck{Status: outOfService})
return
}

// check is morty controller is up
_, err = http.Get(s.cfg.MortyControllerEndpoint + "/_/health")
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
json.NewEncoder(w).Encode(&healthcheck{Status: outOfService})
return
}

// check is rick is up
_, err = http.Get(s.cfg.NluApiEndpoint + "/docs")
if err != nil {
Expand Down

0 comments on commit af7d4a5

Please sign in to comment.