Documentation
¶
Overview ¶
Package httpapi provides admin and monitor HTTP servers for the GoBridge runtime. The admin server exposes bridge lifecycle, route inspection, and DLQ management behind mandatory API key authentication. The monitor server exposes unauthenticated health/liveness/readiness probes for orchestrators, plus authenticated endpoints for topology, route detail, and log access. CORS is disabled by default and wildcard origins are rejected at startup.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
AdminAddr string `json:"admin_addr"`
MonitorAddr string `json:"monitor_addr"`
AdminAPIKey string `json:"-"`
MonitorAPIKey string `json:"-"`
CORSOrigins string `json:"cors_origins"`
}
Config holds HTTP server configuration.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with security-first defaults. CORS is disabled (empty origins) and must be explicitly configured. API keys must be set before starting; the server rejects startup without an AdminAPIKey.
type Option ¶
type Option func(*Server)
Option configures a Server.
func WithAuditLogger ¶
func WithAuditLogger(a ports.AuditLogger) Option
WithAuditLogger sets the audit logger for security-relevant operations.
func WithServerLogger ¶
WithServerLogger sets the logger.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server manages the admin and monitor HTTP endpoints.
func (*Server) MonitorMux ¶
MonitorMux returns a ServeMux wired with monitor routes. It is intended for tests and ad-hoc mounting; production servers use Start, which applies middleware around the same route registration.
type SlogAuditLogger ¶
type SlogAuditLogger struct {
// contains filtered or unexported fields
}
SlogAuditLogger implements ports.AuditLogger by writing structured audit events to a slog.Logger at Info level with an "audit" group.
func NewSlogAuditLogger ¶
func NewSlogAuditLogger(l *slog.Logger) *SlogAuditLogger
NewSlogAuditLogger creates an audit logger that writes to the given slog.Logger.
func (*SlogAuditLogger) Log ¶
func (a *SlogAuditLogger) Log(_ context.Context, ev ports.AuditEvent)