Add GET/POST /settings handlers with injected applier

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 20:10:47 -04:00
parent e3351b3d70
commit 2a196bcdb2
3 changed files with 159 additions and 0 deletions
+8
View File
@@ -14,6 +14,7 @@ import (
"antidrift/internal/domain"
"antidrift/internal/session"
"antidrift/internal/settings"
"antidrift/internal/statemachine"
"github.com/gin-gonic/gin"
@@ -29,6 +30,11 @@ type Server struct {
mu sync.Mutex
timer *time.Timer
settingsMu sync.Mutex
settings settings.Settings
settingsPath string
applyFn func(settings.Settings) error
}
func NewServer(ctrl *session.Controller) *Server {
@@ -69,6 +75,8 @@ func (s *Server) Router() *gin.Engine {
r.POST("/refocus", s.handleRefocus)
r.POST("/ontask", s.handleOnTask)
r.POST("/knowledge/path", s.handleKnowledgePath)
r.GET("/settings", s.handleGetSettings)
r.POST("/settings", s.handlePostSettings)
return r
}