mirror of
https://github.com/FJurmanovic/sugarr.git
synced 2026-11-11 15:51:09 +00:00
init
This commit is contained in:
26
internal/controller/health.go
Normal file
26
internal/controller/health.go
Normal file
@@ -0,0 +1,26 @@
|
||||
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,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user