mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 03:56:37 +00:00
Move /healthz handler to handlers package
Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
This commit is contained in:
@ -232,11 +232,11 @@ func runMetricsServer() {
|
||||
metricsHandler := metrics.PrometheusHandler()
|
||||
router := mux.NewRouter()
|
||||
router.Handle("/metrics", metricsHandler)
|
||||
router.HandleFunc("/healthz", healthzHandler)
|
||||
router.HandleFunc("/healthz", handlers.HealthzHandler)
|
||||
|
||||
port := 8082
|
||||
readTimeout := time.Duration(5) * time.Second
|
||||
writeTimeout := time.Duration(5) * time.Second
|
||||
readTimeout := 5 * time.Second
|
||||
writeTimeout := 5 * time.Second
|
||||
|
||||
s := &http.Server{
|
||||
Addr: fmt.Sprintf(":%d", port),
|
||||
@ -248,16 +248,3 @@ func runMetricsServer() {
|
||||
|
||||
log.Fatal(s.ListenAndServe())
|
||||
}
|
||||
|
||||
func healthzHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
switch r.Method {
|
||||
case http.MethodGet:
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte("OK"))
|
||||
break
|
||||
|
||||
default:
|
||||
w.WriteHeader(http.StatusMethodNotAllowed)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user