Add Postgres storage layer and CRUD handlers
Add the store package (pgx-backed repository) with CRUD for the core resources the compiler needs: fabrics, zones, address groups, portgroups, devices, bindings, rules, policies. Every mutation bumps a global config generation. Wire real JSON CRUD handlers with token auth, source/dest grammar validation on rule create, and the agent status-report endpoint. Migration 0001 verified against Postgres 17.
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
|
||||
"git.unkin.net/unkin/tomswallapi/internal/database"
|
||||
"git.unkin.net/unkin/tomswallapi/internal/store"
|
||||
)
|
||||
|
||||
// Options configures a Server.
|
||||
@@ -27,6 +28,7 @@ type Options struct {
|
||||
// Server serves the tomswallapi HTTP API.
|
||||
type Server struct {
|
||||
db *database.DB
|
||||
store *store.Store
|
||||
writeToken string
|
||||
agentToken string
|
||||
version string
|
||||
@@ -36,6 +38,7 @@ type Server struct {
|
||||
func New(o Options) *Server {
|
||||
return &Server{
|
||||
db: o.DB,
|
||||
store: store.New(o.DB.Pool),
|
||||
writeToken: o.WriteToken,
|
||||
agentToken: o.AgentToken,
|
||||
version: o.Version,
|
||||
|
||||
Reference in New Issue
Block a user