initial commit

This commit is contained in:
Tordarus 2021-12-13 02:28:09 +01:00
parent 8905e5ab00
commit b680ac3460
2 changed files with 31 additions and 0 deletions

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module git.tordarus.net/Tordarus/dockerhealth
go 1.17

28
health.go Normal file
View 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)
}
}