add health service
This commit is contained in:
parent
ab14f1d9e3
commit
4a2e43ecf2
1 changed files with 12 additions and 0 deletions
|
@ -5,6 +5,8 @@ import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
@ -93,5 +95,15 @@ func main() {
|
||||||
GetCertificate: cm.Get,
|
GetCertificate: cm.Get,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
go runHealthService()
|
||||||
|
|
||||||
log.Fatal("server exited", zap.Error(s.ListenAndServeTLS()))
|
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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue