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.
21 lines
505 B
Go
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)
|
|
}
|