mirror of
https://github.com/Luzifer/promcertcheck.git
synced 2024-09-19 01:12:56 +00:00
Introduce /httpStatus endpoint
which will respond with HTTP200 if everything is fine or HTTP500 if one or more certificates are broken Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
c3f86a29f0
commit
357693db38
11
http.go
11
http.go
@ -26,6 +26,17 @@ func htmlHandler(res http.ResponseWriter, r *http.Request) {
|
||||
}, res)
|
||||
}
|
||||
|
||||
func httpStatusHandler(res http.ResponseWriter, r *http.Request) {
|
||||
httpStatus := http.StatusOK
|
||||
for _, mon := range probeMonitors {
|
||||
if mon.Status != certificateOK {
|
||||
httpStatus = http.StatusInternalServerError
|
||||
}
|
||||
}
|
||||
|
||||
res.WriteHeader(httpStatus)
|
||||
}
|
||||
|
||||
func jsonHandler(res http.ResponseWriter, r *http.Request) {
|
||||
res.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(res).Encode(probeMonitors)
|
||||
|
Loading…
Reference in New Issue
Block a user