Add health endpoint
authorMitja Adebahr <extern.mitja.adebahr@jimdo.com>
Thu, 25 Feb 2021 10:51:14 +0000 (11:51 +0100)
committerMitja Adebahr <extern.mitja.adebahr@jimdo.com>
Wed, 10 Mar 2021 08:15:12 +0000 (09:15 +0100)
The root endpoint exposes too much data. So it cannot be used as public
health check endpoint.

Signed-off-by: Mitja Adebahr <extern.mitja.adebahr@jimdo.com>
main.go

diff --git a/main.go b/main.go
index af1279de738ac9ab87b1b9d308468363b1e1dbbf..f2294d752ad9468c184a67efbb676a8de95150af 100644 (file)
--- a/main.go
+++ b/main.go
@@ -309,6 +309,10 @@ func run() int {
                        }
                })
        http.Handle(path.Join(*routePrefix, "/metrics"), promhttp.Handler())
+       http.HandleFunc(path.Join(*routePrefix, "/-/healthy"), func(w http.ResponseWriter, r *http.Request) {
+               w.WriteHeader(http.StatusOK)
+               w.Write([]byte("Healthy"))
+       })
        http.HandleFunc(path.Join(*routePrefix, "/probe"), func(w http.ResponseWriter, r *http.Request) {
                sc.Lock()
                conf := sc.C