initial commit
This commit is contained in:
parent
8905e5ab00
commit
b680ac3460
28
health.go
Normal file
28
health.go
Normal file
@ -0,0 +1,28 @@
|
||||
package dockerhealth
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
var server = &http.Server{
|
||||
Handler: new(httpHandler),
|
||||
Addr: "localhost:60000",
|
||||
}
|
||||
|
||||
var Healthy bool = true
|
||||
|
||||
func init() {
|
||||
server.ListenAndServe()
|
||||
}
|
||||
|
||||
type httpHandler struct {
|
||||
http.Handler
|
||||
}
|
||||
|
||||
func (h *httpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if Healthy {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
} else {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user