Files
bookhoard/internal/router/system.go
john-okeefe 5451e82b2d router: register SidecarHandler routes for system config and device sidecar
Phase 1: Register routes that were defined but never connected

- Add GET/PUT /api/system/config routes (admin-only) for system
  configuration in new internal/router/system.go
- Add GET /api/devices/:id/sidecar routes for device sidecar config
- Add SidecarHandler to router Config struct
- Instantiate SidecarHandler in main.go with config for fallback support

These routes were implemented in handlers/sidecar.go but never registered,
breaking the ability to configure base URLs for device sync.
2026-03-11 16:41:32 -04:00

21 lines
505 B
Go

package router
import (
"bookhoard/internal/handlers"
)
func registerSystemRoutes(cfg *Config) {
e := cfg.Echo
// JWT middleware
jwtMiddleware := createJWTMiddleware(cfg)
// Protected routes (admin-only)
protected := e.Group("/api", jwtMiddleware)
system := protected.Group("/system", handlers.AdminMiddleware)
// System configuration routes (admin-only)
system.GET("/config", cfg.SidecarHandler.GetSystemConfiguration)
system.PUT("/config", cfg.SidecarHandler.UpdateSystemConfiguration)
}