Files
hanko/backend/handler/status.go
2025-09-25 19:15:20 +02:00

28 lines
626 B
Go

package handler
import (
"github.com/labstack/echo/v4"
"github.com/teamhanko/hanko/backend/v2/persistence"
"net/http"
)
type StatusHandler struct {
persister persistence.Persister
}
func NewStatusHandler(persister persistence.Persister) *StatusHandler {
return &StatusHandler{
persister: persister,
}
}
func (h *StatusHandler) Status(c echo.Context) error {
// random query to check DB connectivity
_, err := h.persister.GetJwkPersister().GetAll()
if err != nil {
return c.Render(http.StatusInternalServerError, "status", map[string]bool{"dbError": true})
}
return c.Render(http.StatusOK, "status", nil)
}