Documentation
¶
Index ¶
- type APIV2Option
- type Option
- func WithAddress(addr string) Option
- func WithAllowedOrigins(origins []string) Option
- func WithApiV2(stack Stack, opts ...APIV2Option) Option
- func WithEnforcer(enforcer auth.Enforcer) Option
- func WithOidc(oidcClient *auth.OIDCClient) Option
- func WithPort(port uint) Option
- func WithReadinessCheck(check func(context.Context) error) Option
- func WithTLS(cfg TLSConfig) Option
- func WithVersion(version, sha string) Option
- type Server
- type Stack
- type TLSConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIV2Option ¶
type APIV2Option func(*apiV2Config)
APIV2Option configures the API-v2 GraphQL handler.
func WithGraphQLIntrospection ¶
func WithGraphQLIntrospection() APIV2Option
type Option ¶
Option defines a functional option for Server.
func WithAllowedOrigins ¶
WithAllowedOrigins restricts the CORS allowed origins. Defaults to same-origin only (empty slice) when not set. Pass explicit origins for deployments that serve the UI from a different host than the API.
func WithApiV2 ¶
func WithApiV2(stack Stack, opts ...APIV2Option) Option
func WithEnforcer ¶
func WithOidc ¶
func WithOidc(oidcClient *auth.OIDCClient) Option
func WithReadinessCheck ¶
WithPort sets the server port. WithReadinessCheck makes /ready also depend on a dependency probe (typically the database), so a pod that cannot reach it is taken out of the Service instead of failing requests. /health stays dependency-free on purpose: restarting pods does not fix a database outage.
func WithVersion ¶
WithVersion records the build identity so it can be served to clients.
The UI is embedded in this binary (see ui.Assets), so these values describe the frontend being served as much as the backend, which is what lets the update prompt name the version it is offering.
type Server ¶
func (*Server) RegisterMiddlewares ¶
func (s *Server) RegisterMiddlewares()
func (*Server) RegisterRoutes ¶
func (s *Server) RegisterRoutes()
Routes registers all HTTP routes and handlers on the server's router.
type Stack ¶
type Stack struct {
Incidents inbound.IncidentService
Messages inbound.MessageService
Layers inbound.LayerService
Features inbound.FeatureService
Access inbound.AccessService
Schadenplaetze inbound.SchadenplatzService
Resources inbound.ResourceService
Timeline inbound.TimelineService
Tiles inbound.TileService
IncidentAccessChecker outbound.IncidentAccessChecker
GlobalAccessChecker outbound.GlobalAccessChecker
AccessQueries outbound.AccessQueries
Queries outbound.Queries
// MaxAttachmentSize is the maximum allowed size in bytes for file attachments.
// Zero means no server-side limit (domain validation still applies).
MaxAttachmentSize int64
}
Stack contains the application dependencies exposed by the server.
type TLSConfig ¶
type TLSConfig struct {
// CertFile and KeyFile point at a PEM key pair managed outside the server.
CertFile string
KeyFile string
// ACMEDomains enables ACME when non-empty. Certificates are issued for
// these hostnames only.
ACMEDomains []string
// ACMEEmail is registered with the CA for expiry notices. Optional.
ACMEEmail string
// ACMECacheDir persists account keys and certificates across restarts.
// Without it every restart requests a new certificate and will hit the
// CA's rate limits.
ACMECacheDir string
// ACMEDirectoryURL overrides the CA. Empty means Let's Encrypt production;
// point it at the staging directory while testing.
ACMEDirectoryURL string
}
TLSConfig selects how the server obtains its certificate. Exactly one of the two modes must be configured: a static key pair, or ACME.