Documentation
¶
Overview ¶
Package app assembles the directory hub from its configuration: the stores, the snapshot cache, the backends, the policy, the connectors, the recovery path and the three listeners.
It is a package rather than the body of main because this is where the service's behaviour is decided — which store, which shape of recovery, who may call the API listener, what URL the OAuth redirects are built from — and every one of those is somewhere a deployment can be quietly wrong. Four of them were, and none of it was reachable by a test while it lived in main().
The API listener carries DirectoryService for consumers on the cluster network. The console listener carries the operator services, the login routes and the consent callback, behind an authenticating gateway or behind the hub's own sign-in. `demo` gives two tenants held in memory, which need no credential and no network.
Index ¶
- func FallbackPolicy(demonstration bool) (policy.Policy, error)
- type App
- func (a *App) Audit() audit.Recorder
- func (a *App) AuditQuery() (queryURL, audience string)
- func (a *App) AuditRequests(next http.Handler) http.Handler
- func (a *App) Close()
- func (a *App) ConsoleHandler() http.Handler
- func (a *App) ConsoleServer() *server.ConsoleServer
- func (a *App) GitHubCatalogue() *catalogue.Catalogue
- func (a *App) GitHubCatalogueApps() server.GitHubCatalogueApps
- func (a *App) GitHubMints() *mints.Ring
- func (a *App) HealthHandler() http.Handler
- func (a *App) Hub() *hub.Hub
- func (a *App) Policy() *policy.Set
- func (a *App) Readiness() health.Dependency
- func (a *App) Run(ctx context.Context) error
- func (a *App) RunLoops(ctx context.Context) error
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FallbackPolicy ¶ added in v1.62.0
FallbackPolicy is what a service whose document names no policy decides by: the demonstration's policy under `demo`, and the built-in two groups otherwise. The composition root hands it to config.LoadConfig.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is an assembled hub: three handlers and the background loops.
func (*App) Audit ¶
Audit is the service's one recorder, for the half assembled after this one: both halves write one history.
func (*App) AuditQuery ¶
AuditQuery is the audit installation's query service and the audience the console's tokens for it carry, or an empty URL when none is connected. The merged service wires it to the issuer, which mints them.
func (*App) AuditRequests ¶
AuditRequests puts what an audit record keeps of each request into the context of everything next serves, with this deployment's decision on X-Forwarded-For. The merged service wraps the issuer's whole origin in it, so a token exchange records where it came from as a console call does.
func (*App) ConsoleHandler ¶
ConsoleHandler is the operator listener: services, login, the SPA.
func (*App) ConsoleServer ¶
func (a *App) ConsoleServer() *server.ConsoleServer
ConsoleServer is the console's own server, for a caller that has to finish wiring it after both halves exist.
func (*App) GitHubCatalogue ¶
GitHubCatalogue is every GitHub App the deployment declares, for the half that mints their installation tokens under its grants.
func (*App) GitHubCatalogueApps ¶
func (a *App) GitHubCatalogueApps() server.GitHubCatalogueApps
GitHubCatalogueApps is where created catalogue Apps and their keys are kept, or nil where the deployment keeps none: what the issuer half reads an App's key from to mint a token.
func (*App) GitHubMints ¶
GitHubMints is the ring of recent installation token requests, for the half that mints them to write into. The console reads the same ring: an App's page shows what this service minted without asking the audit trail for a listing narrowed to one App, which is a scan.
func (*App) HealthHandler ¶
HealthHandler is liveness and readiness.
func (*App) Policy ¶
Policy is the policy in force, for a caller that has to act on the SAME one.
The merged service loads it once and hands it to both halves. Two halves loading it independently is precisely the class of failure the merge existed to end: they read the same file today, but their fallbacks differ, so a deployment that configured neither would run a directory answering from a built-in policy and an issuer refusing to start — or worse, two policies that agree until one of them is changed.
func (*App) Readiness ¶
func (a *App) Readiness() health.Dependency
Readiness is the snapshot store as a dependency, for a caller that assembles a health endpoint of its own. The merged service has one /readyz answering for both halves, and a half that cannot read a snapshot cannot answer anything.
type Config ¶
type Config struct {
// Reader makes the hub only read snapshots: the directory is another
// module's (`google.remote`), whose schedule refreshes them. No workspace is
// adopted, attached or reopened here, and no sign-in, request or loop
// refreshes or reads a directory. Unset keeps the hub that owns its
// directory, which is a local install with no remote.
Reader bool
// GoogleIssuer and GoogleConsole reach the Google module when it is another
// function (`google.remote`): the first signs people in (`google.identify`,
// caller class `issuer`), the second asks it the console's questions (caller
// class `console`). Nil is the module in this process. They are set with
// Reader: a hub that holds no workspaces has no connector of its own.
GoogleIssuer, GoogleConsole modcall.Caller
// GitHubRemote, SlackRemote and CloudflareRemote say that the module runs as
// another function (`<module>.remote`). The hub then opens none of that
// module's stores, blobs, credentials or maintenance gate: every operation on
// them is the module's, asked over modcall, and this process holds no access
// to its data (v1.76 E-FIN). Unset is the module in this process, as the
// demonstration and the tests have it.
GitHubRemote, SlackRemote, CloudflareRemote bool
// contains filtered or unexported fields
}
Config is the whole of the hub's configuration. The chart sets it from the values; the defaults are what a laptop needs.
Built from the service's configuration file (see FromConfig).
func FromConfig ¶
FromConfig builds the hub's settings from the service document and the policy document, which the caller has already held to their schemas and checks. p is nil for the built-in policy (or the demonstration's). What a schema cannot say is checked here, before anything starts.
func (Config) AuditConfig ¶ added in v1.76.0
AuditConfig is the audit configuration the legacy `audit` keys say, before the resolved adapter table is applied to it (audit.FromPlan).