NFSSVC-25 Isolate health-checkers

- Add mime-type for health-check response
- Remove legacy health-checkers
This commit is contained in:
Evgeniy Kulikov 2020-07-21 17:43:45 +03:00
parent 4098bfda9c
commit 1c6da41bee
2 changed files with 5 additions and 5 deletions

View file

@ -12,8 +12,9 @@ type Healthy interface {
}
const (
healthyState = "NeoFS S3 Gateway is "
// defaultContentType = "text/plain; charset=utf-8"
healthyState = "NeoFS S3 Gateway is "
hdrContentType = "Content-Type"
defaultContentType = "text/plain; charset=utf-8"
)
func attachHealthy(r *mux.Router, h Healthy) {
@ -22,6 +23,7 @@ func attachHealthy(r *mux.Router, h Healthy) {
StrictSlash(true)
healthy.HandleFunc("/ready", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set(hdrContentType, defaultContentType)
w.WriteHeader(http.StatusOK)
_, _ = fmt.Fprintln(w, healthyState+"ready")
})
@ -35,6 +37,7 @@ func attachHealthy(r *mux.Router, h Healthy) {
code = http.StatusBadRequest
}
w.Header().Set(hdrContentType, defaultContentType)
w.WriteHeader(code)
_, _ = fmt.Fprintln(w, healthyState+msg)
})

View file

@ -41,9 +41,6 @@ func AttachS3API(r *mux.Router, obj ObjectLayer, l *zap.Logger) {
globalServerConfigMu.Unlock()
}
// Add healthcheck router
registerHealthCheckRouter(r)
// Add API router.
registerAPIRouter(r, true, true)