Documentation
¶
Overview ¶
Package server routes the service's HTTP requests: health and readiness, metrics (direct connections only), Feishu's HTTP callbacks, the drill check, the REST API, the MCP endpoint and the pages (the public ones at the root, the console under /console). Machines (probes, the rule engine) use the gateway's own listener.
Index ¶
Constants ¶
const CSP = "default-src 'none'; style-src 'self'; img-src 'self' data:; base-uri 'none'; form-action 'none'; frame-ancestors 'none'"
CSP for everything the service serves itself; the pages bring their own.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Deps ¶
type Deps struct {
Bridge *bridge.Bridge
API *api.Server
MCP http.Handler
Metrics http.Handler
Feishu http.Handler
DrillRun func() exercise.Run
Exercise *exercise.Authority
Log *slog.Logger
Web *web.Server
// Standby, when set (a primary/standby pair's lease was not held at the last attempt), turns
// /healthz to 503: the load balancer or the VIP in front sends its traffic to the primary.
Standby func() bool
// Live, when set, is the instance's own health (it can reach PostgreSQL), including a waiting
// standby. Docker's health check asks /livez so it does not restart a healthy standby.
// Nil treats the process as live.
Live func() bool
// OAuth is Beacon's authorization server for MCP clients: its metadata, registration, token and
// revocation endpoints (the console serves /oauth/authorize); nil leaves them out.
OAuth *oauth.Server
}
Deps are what the routes need. Feishu is nil unless callbacks come over HTTP; Web nil serves only the public page at / (without status pages, the console or the pages people open from the chat).