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"
|
||||
"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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue