mirror of
https://github.com/lovelaze/nebula-sync.git
synced 2025-11-05 18:29:19 +01:00
18 lines
318 B
Go
18 lines
318 B
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
func (s *Server) healthHandler(w http.ResponseWriter, r *http.Request) {
|
|
if s.healthy() {
|
|
w.WriteHeader(http.StatusOK)
|
|
} else {
|
|
w.WriteHeader(http.StatusInternalServerError)
|
|
}
|
|
}
|
|
|
|
func (s *Server) healthy() bool {
|
|
return len(s.state.Stack) > 0 && s.state.Stack[0].Success
|
|
}
|