Documentation
¶
Overview ¶
Package api is the Cairn control-plane HTTP server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
Store store.Store
Queue provisioning.Queue
// Resolvers maps each Git host to its OAuth resolver. Multiple hosts may be
// registered at once — students self-enroll via the resolver for their
// classroom's host, and operators log in via the LoginHost resolver.
Resolvers map[adapter.Host]identity.Resolver
// LoginHost identifies which resolver handles operator login. When empty, the
// server picks whichever resolver is available (GitHub preferred).
LoginHost adapter.Host
// WebDir, if set, is a directory of built dashboard assets (web/dist) served
// at the root with SPA fallback, so the API and UI ship as one binary.
WebDir string
// AuthEnabled gates operator authentication. When false (the default), the
// management API is open and a synthetic operator is used — convenient for
// local development, but every deployment should enable it.
AuthEnabled bool
// AdminUsers is the allowlist of host usernames permitted to operate this
// instance (only consulted when AuthEnabled).
AdminUsers []string
// CookieSecure sets the Secure flag on the session cookie; enable it behind HTTPS.
CookieSecure bool
// GraderConfigured reports whether a grading runner has been wired up. When
// false, POST /assignments/{id}/grade returns 409 immediately instead of
// enqueueing jobs that would instantly fail in the worker.
GraderConfigured bool
// Adapters is the set of configured host adapters. handleCreateClassroom
// validates a classroom's host against these so a classroom can only be
// created for a host Cairn can actually provision against — deriving the
// allowlist from runtime registration keeps it correct as hosts are added
// (e.g. both "forgejo" and "gitea" once the Gitea-family adapter is wired).
// The student API also uses them for RepoWebURL links.
Adapters map[adapter.Host]adapter.Adapter
// WebhookSecrets is the per-host secret used to verify incoming push-webhook
// HMAC signatures. A host with no secret here has its deliveries rejected.
WebhookSecrets map[adapter.Host]string
}
Options holds the Server's dependencies.
Click to show internal directories.
Click to hide internal directories.