Documentation
¶
Overview ¶
Package server is the HTTP composition root for the serve command: it builds the root mux, wraps it in compression and the access log, and mounts the route sets that live in their own packages — the JSON API (internal/api) under /api/, and the HTML web UI (internal/web, serving its own /static/ assets) at /, both behind the web UI's login gate. The health endpoints are its own, since serving lifecycle is not a web or API concern.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds the dependencies shared by every mounted route set.
func New ¶
func New( db *store.Store, cfg *config.Config, addr, cfgPath string, ing *ingest.Manager, log zerolog.Logger, ) *Server
New returns a Server backed by db, using cfg for request defaults. addr is the bound listen address, forwarded to the web UI for display only. cfgPath is the loaded config's path, shown read-only by the web UI's config viewer. ing owns the in-process ingest runs the web UI triggers. log backs the access log.
func (*Server) Dev ¶ added in v0.2.0
Dev serves the embedded assets no-cache, so an edited stylesheet or script shows on the next reload instead of after the normal cache window.
func (*Server) Drain ¶
func (s *Server) Drain()
Drain flips readiness to 503 before the HTTP server stops accepting, giving a proxy or orchestrator a window to route away while in-flight requests finish.
func (*Server) Routes ¶
Routes builds the root handler. The API sub-mux keeps its full /api/ patterns, so mounting it under "/api/" (no StripPrefix) lets its method+path patterns match unchanged.
func (*Server) TrustProxies ¶ added in v0.2.0
TrustProxies sets the networks whose forwarding headers the login gate believes, in place of its loopback default. Empty trusts none.