mirror of
https://github.com/FJurmanovic/sugarr.git
synced 2026-11-11 15:51:09 +00:00
27 lines
600 B
Go
27 lines
600 B
Go
package controller
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/fjurmanovic/sugarr/internal/utl/configs"
|
|
"github.com/fjurmanovic/sugarr/internal/utl/httputil"
|
|
)
|
|
|
|
type HealthController struct {
|
|
cfg *configs.Config
|
|
}
|
|
|
|
func NewHealthController(mux *http.ServeMux, cfg *configs.Config) *HealthController {
|
|
c := &HealthController{cfg: cfg}
|
|
mux.HandleFunc("GET /health", c.handle)
|
|
return c
|
|
}
|
|
|
|
func (c *HealthController) handle(w http.ResponseWriter, _ *http.Request) {
|
|
httputil.WriteJSON(w, http.StatusOK, map[string]any{
|
|
"status": "ok",
|
|
"llm": c.cfg.LLMEnabled,
|
|
"radarr": c.cfg.RadarrEnabled,
|
|
})
|
|
}
|