mirror of
https://github.com/amir20/dozzle.git
synced 2026-01-03 19:45:01 +01:00
26 lines
525 B
Go
26 lines
525 B
Go
package web
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"github.com/amir20/dozzle/internal/docker"
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func (h *handler) healthcheck(w http.ResponseWriter, r *http.Request) {
|
|
log.Trace("Executing healthcheck request")
|
|
var client docker.Client
|
|
for _, v := range h.clients {
|
|
client = v
|
|
break
|
|
}
|
|
|
|
if ping, err := client.Ping(r.Context()); err != nil {
|
|
log.Error(err)
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
} else {
|
|
fmt.Fprintf(w, "OK API Version %v", ping.APIVersion)
|
|
}
|
|
}
|