package handlers import ( "context" "time" "github.com/gofiber/fiber/v2" "github.com/gosec/gsc-shell-api/internal/db" ) type HealthHandlers struct { DB *db.DB } func (h *HealthHandlers) Live(c *fiber.Ctx) error { return c.JSON(fiber.Map{"status": "live"}) } func (h *HealthHandlers) Ready(c *fiber.Ctx) error { ctx, cancel := context.WithTimeout(c.UserContext(), 2*time.Second) defer cancel() if _, err := h.DB.ListApps(ctx); err != nil { return c.Status(fiber.StatusServiceUnavailable). JSON(fiber.Map{"status": "not-ready", "error": err.Error()}) } return c.JSON(fiber.Map{"status": "ready"}) }