Documentation
¶
Overview ¶
Package api provides the HTTP server for the stackit-web application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequestIDFromContext ¶ added in v0.19.0
RequestIDFromContext is kept here as a re-export for callers in the api package; handlers in other packages import internal/api/reqid directly.
Types ¶
type AuthConfig ¶ added in v0.19.0
AuthConfig is the runtime auth setup. SessionStore must outlive the Server's lifetime (close it after Shutdown returns).
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the stackit-web HTTP server. Per-repo state (engine, watcher, broadcaster) lives on each registry entry — the server only owns transport-level concerns.
func NewServer ¶
func NewServer(cfg ServerConfig) *Server
NewServer creates a new API server backed by the given registry.
type ServerConfig ¶
type ServerConfig struct {
// BindAddr is the host/IP to listen on. Empty means "all interfaces".
// apps/server picks a safe default (127.0.0.1) and switches to the
// public-facing form when PORT or STACKIT_PUBLIC is set.
BindAddr string
Port int
CORSOrigins []string
APIPrefixes []string
StaticFS fs.FS
Registry *registry.Registry
// Auth bundles the OAuth handler, session store, and surrounding state
// needed to gate /api/* routes behind GitHub login. When nil the server
// runs without authentication; that mode is only safe on a private
// network (localhost dev, tunneled access). apps/server refuses to
// start unauthenticated when STACKIT_PUBLIC or $PORT are set unless
// -auth-disabled is passed explicitly.
Auth *AuthConfig
}
ServerConfig holds configuration for the API server.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package auth implements GitHub OAuth + session cookies + an allowlist gate so stackit-server can be safely exposed on the public web.
|
Package auth implements GitHub OAuth + session cookies + an allowlist gate so stackit-server can be safely exposed on the public web. |
|
Package registry holds the set of repositories served by the stackit server, keyed by a stable repoID.
|
Package registry holds the set of repositories served by the stackit server, keyed by a stable repoID. |
|
Package reqid holds the request-ID context plumbing shared between the middleware that mints the ID (internal/api) and the handlers that want to include it in audit log lines (internal/api/handlers).
|
Package reqid holds the request-ID context plumbing shared between the middleware that mints the ID (internal/api) and the handlers that want to include it in audit log lines (internal/api/handlers). |
|
Package watcher provides file system monitoring for git ref changes.
|
Package watcher provides file system monitoring for git ref changes. |
Click to show internal directories.
Click to hide internal directories.