Files
synapbus/internal/admin/server.go
T
Algis DumbrisandClaude Opus 4.6 cad0138337 chore: migrate to github.com/synapbus org and add logo assets
Move module path from github.com/smart-mcp-proxy/synapbus to
github.com/synapbus/synapbus across all Go imports (47 files).
Add constellation logo options generated via FLUX 1.1 Pro.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 05:46:46 +02:00

53 lines
1.4 KiB
Go

// Package admin provides a Unix domain socket server for local administration.
package admin
import (
"database/sql"
"log/slog"
"net"
"github.com/synapbus/synapbus/internal/agents"
"github.com/synapbus/synapbus/internal/auth"
"github.com/synapbus/synapbus/internal/channels"
"github.com/synapbus/synapbus/internal/messaging"
"github.com/synapbus/synapbus/internal/trace"
)
// Services holds references to all services the admin socket can control.
type Services struct {
Users *auth.SQLiteUserStore
Sessions auth.SessionStore
Agents *agents.AgentService
Messages *messaging.MessagingService
Channels *channels.Service
Traces trace.TraceStore
DataDir string
}
// AdminServer is a Unix domain socket server for local administration.
type AdminServer struct {
listener net.Listener
db *sql.DB
services *Services
logger *slog.Logger
socketPath string
done chan struct{}
}
// NewServer creates a new admin server bound to a Unix socket at {dataDir}/synapbus.sock.
// If socketPath is non-empty it overrides the default.
func NewServer(socketPath string, db *sql.DB, services *Services, logger *slog.Logger) *AdminServer {
return &AdminServer{
db: db,
services: services,
logger: logger.With("component", "admin"),
socketPath: socketPath,
done: make(chan struct{}),
}
}
// SocketPath returns the path to the Unix socket.
func (s *AdminServer) SocketPath() string {
return s.socketPath
}