Documentation
¶
Overview ¶
Package server holds HTTP routing, middleware and handlers.
Handlers know neither SQL (invariant 5) nor auth providers (invariant 4): data access goes through repository.Store, and identity arrives as a player_id on the request context.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Build ¶
Build is what this binary can say about itself, set at link time.
Two values rather than one string, so the page can show them as two things: which commit, and how old it is. CommitTime is when that commit was made, not when the binary was built — a build clock would make two images from one commit differ, and "is the same thing running here and there" is the question this exists to answer.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server bundles configuration, dependencies and routing.
func New ¶
func New(cfg config.Config, store repository.Store, log *slog.Logger, a auth.SessionAuthenticator, build Build) *Server
New wires up the server. The authenticator is an interface so that later providers (OIDC, WebAuthn) take effect without touching any handler.
func (*Server) GrantBootstrapAdmin ¶
GrantBootstrapAdmin gives the flag to the player SP_BOOTSTRAP_ADMIN names.
Run at every start, not only the first. Somebody who withdraws the flag from the last admin gets back in by restarting with the variable set, and not by opening psql — which is the price issue #73 puts on a flag and what docs/adr/0008 answers.
A name nobody has is a warning, not a failure. The variable is often set before the person it names has joined, and refusing to start over it would turn a typo into an outage.
func (*Server) MetricsHandler ¶ added in v0.8.0
MetricsHandler is what the metrics listener serves, or nil when SP_METRICS_ADDR is unset.