From b939672a86d8ca7d7f1b072583e9ccf448574e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Carpintero?= Date: Fri, 13 Dec 2024 13:07:30 +0100 Subject: [PATCH] Add healthcheck --- internal/http/check.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/http/check.go b/internal/http/check.go index 2b5ce09..04ec2c2 100644 --- a/internal/http/check.go +++ b/internal/http/check.go @@ -112,6 +112,10 @@ func (c *Check) ServeHTTP(w http.ResponseWriter, r *http.Request) { // RunAndServe implements the behavior needed by the sdk for a check runner to // execute a check. func (c *Check) RunAndServe() { + http.HandleFunc("/healthcheck", func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(`"OK"`)) + }) http.HandleFunc("/run", c.ServeHTTP) c.Logger.Info(fmt.Sprintf("Listening at %s", c.server.Addr)) go func() {