add health service

This commit is contained in:
Seán C McCord 2023-09-30 17:02:49 -04:00
parent ab14f1d9e3
commit 4a2e43ecf2
Signed by: scm
GPG key ID: FC678714ACA347CB

View file

@ -5,6 +5,8 @@ import (
"crypto/tls"
"encoding/json"
"flag"
"fmt"
"net/http"
"os"
"os/signal"
"syscall"
@ -93,5 +95,15 @@ func main() {
GetCertificate: cm.Get,
}
go runHealthService()
log.Fatal("server exited", zap.Error(s.ListenAndServeTLS()))
}
func runHealthService() {
http.HandleFunc("/health", func(w http.ResponseWriter, req *http.Request) {
w.Write([]byte("OK")) //nolint:errcheck
})
http.ListenAndServe(fmt.Sprintf(":%d", healthPort), nil) //nolint:errcheck
}