mirror of
https://github.com/amir20/dozzle.git
synced 2025-12-21 21:33:18 +01:00
22 lines
479 B
Go
22 lines
479 B
Go
package web
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
func (h *handler) healthcheck(w http.ResponseWriter, r *http.Request) {
|
|
log.Debug().Msg("Executing healthcheck")
|
|
|
|
clients := h.hostService.LocalClients()
|
|
for _, client := range clients {
|
|
if err := client.Ping(r.Context()); err != nil {
|
|
log.Error().Err(err).Str("host", client.Host().Name).Msg("error pinging host")
|
|
w.WriteHeader(http.StatusInternalServerError)
|
|
}
|
|
}
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
}
|