From 7162167ee0ca0ed21107abf7b1c4b2f72067ab5a Mon Sep 17 00:00:00 2001 From: Jim Sheldon Date: Fri, 3 Jan 2020 12:37:35 -0500 Subject: [PATCH] adding /healthz endpoint (#12) based on https://github.com/drone/boilr-convert/commit/085abc403b6a5bd3289bc79b4ab2009a1ef1e3be --- main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.go b/main.go index 3367b39..2d30cc3 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ package main import ( + "io" "net/http" "github.com/drone/drone-go/plugin/converter" @@ -61,5 +62,11 @@ func main() { logrus.Infof("server listening on address %s", spec.Bind) http.Handle("/", handler) + http.HandleFunc("/healthz", healthz) logrus.Fatal(http.ListenAndServe(spec.Bind, nil)) } + +func healthz(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + io.WriteString(w, "OK") +}