add most basic healthcheck possible (#13)

This commit is contained in:
Jakub 2018-05-27 11:09:11 +02:00 committed by GitHub
parent e061ed0634
commit 9fd68b41e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -24,6 +24,10 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
writeBody(w, rootHTML)
}
func healthHandler(w http.ResponseWriter, r *http.Request) {
writeBody(w, "OK")
}
func writeBody(w io.Writer, body string) {
if _, err := w.Write([]byte(body)); err != nil {
log.Println(err)

View File

@ -45,6 +45,7 @@ func main() {
parseFlags()
http.HandleFunc(metricsPath, metricsHandler(*ipcPathFlag))
http.HandleFunc("/health", healthHandler)
http.HandleFunc("/", rootHandler)
listenAddress := fmt.Sprintf("%s:%d", *hostFlag, *portFlag)