Documentation
¶
Overview ¶
Package server is the v1.3 serve-mode HTTP daemon. It wires the chi router, security middleware, observability endpoints (/health + /metrics), and the read/write API + UI handlers that v1.3-v1.5 fill in across phases. The single entry point is New(), which returns a *Server whose Run(ctx) method blocks until the context cancels — graceful shutdown happens on SIGTERM/SIGINT signaled into the same context.
ADR-015 codifies the UI stack (htmx + Alpine + Tailwind + Preline + vanilla SVG, all go:embed-ed). Single-binary invariant preserved; no Node runtime ships with compliancekit; no CDN is reached at runtime.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Addr is the bind interface; default "127.0.0.1" so the
// out-of-the-box experience is loopback-only (operator opts into
// 0.0.0.0 explicitly).
Addr string
// Port is the TCP port; default 8080. Override via --port.
Port int
// ReadHeaderTimeout caps the time a peer may take to send request
// headers; protects against slowloris-style starvation.
ReadHeaderTimeout time.Duration
// IdleTimeout caps keep-alive idle duration.
IdleTimeout time.Duration
}
Config carries every knob the daemon takes at startup. Loaded by the CLI subcommand from a mix of compliancekit.yaml + flags + env. Defaults below in Default().
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the running daemon. Construct via New(); start via Run().
func New ¶
New builds the daemon. Wires middleware in the right order (recovery → request-id → real-ip → metrics → security headers), mounts /health + /metrics, and leaves the rest of the routing for future phases to attach via the returned *Server's Router() method.
func (*Server) Addr ¶
Addr returns the bound listen address; useful for tests that need the concrete port when cfg.Port == 0 (ephemeral) is requested.
func (*Server) QueueDepthObserver ¶ added in v1.11.0
QueueDepthObserver returns the daemon's worker.DepthObserver implementation so cmd/serve can wire it into the worker pool's autoscale sampler. nil-safe — if the metrics registry isn't yet constructed (zero-value Server), the worker pool silently no-ops.
The interface signature lives in internal/server/worker; we satisfy it without importing the package to avoid a circular dep.
func (*Server) Router ¶
Router returns the chi router so later-phase packages (api/, auth/, ui/) can mount their routes without re-importing the middleware stack. Callers should attach routes before Run().
Directories
¶
| Path | Synopsis |
|---|---|
|
Package api implements the v1.3+ REST API.
|
Package api implements the v1.3+ REST API. |
|
Package assets embeds the compiled UI bundle (Tailwind output + vendored htmx, Alpine, Preline) produced by `make ui`.
|
Package assets embeds the compiled UI bundle (Tailwind output + vendored htmx, Alpine, Preline) produced by `make ui`. |
|
Package auth handles every authentication concern for the v1.3 serve-mode daemon: bcrypt password hashing, DB-backed sessions, double-submit-cookie CSRF protection, and the chi middleware that gates non-public routes.
|
Package auth handles every authentication concern for the v1.3 serve-mode daemon: bcrypt password hashing, DB-backed sessions, double-submit-cookie CSRF protection, and the chi middleware that gates non-public routes. |
|
Package collab owns the v1.8 collaboration data layer that doesn't fit into the comments package: per-finding assignees, per-resource owners, and resource follower opt-ins.
|
Package collab owns the v1.8 collaboration data layer that doesn't fit into the comments package: per-finding assignees, per-resource owners, and resource follower opt-ins. |
|
Package comments owns the goldmark+bluemonday pipeline that turns operator-authored markdown into the sanitized HTML cached in the comments table.
|
Package comments owns the goldmark+bluemonday pipeline that turns operator-authored markdown into the sanitized HTML cached in the comments table. |
|
Package compress is the v1.11 phase 4 HTTP-compression middleware.
|
Package compress is the v1.11 phase 4 HTTP-compression middleware. |
|
Package etag is the v1.11 phase 5 HTTP caching middleware.
|
Package etag is the v1.11 phase 5 HTTP caching middleware. |
|
Package events is the v1.6 SSE event bus the daemon uses to push live state changes to subscribed UI / TUI / API clients without polling.
|
Package events is the v1.6 SSE event bus the daemon uses to push live state changes to subscribed UI / TUI / API clients without polling. |
|
Package logs is the v1.6 phase 6 in-UI log tail.
|
Package logs is the v1.6 phase 6 in-UI log tail. |
|
Package respcache is the v1.11 phase 6 in-memory LRU for hot list responses.
|
Package respcache is the v1.11 phase 6 in-memory LRU for hot list responses. |
|
Package slowlog is the v1.11 phase 7 query-budget + slow-query log.
|
Package slowlog is the v1.11 phase 7 query-budget + slow-query log. |
|
Package store is the persistent-state layer for compliancekit's serve-mode daemon.
|
Package store is the persistent-state layer for compliancekit's serve-mode daemon. |
|
Package ui mounts the v1.3 minimal UI shell on the daemon's chi router.
|
Package ui mounts the v1.3 minimal UI shell on the daemon's chi router. |
|
Package webhook handles inbound webhook receivers — GitHub PR / push events + operator-defined generic webhooks.
|
Package webhook handles inbound webhook receivers — GitHub PR / push events + operator-defined generic webhooks. |
|
Package worker is the v1.3 background job runner.
|
Package worker is the v1.3 background job runner. |