app

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package app wires configuration into running components and serves them.

New builds, in order: blob storage, the site registry, the document store, the pub/sub broker, the people directory, the authenticator, the realtime hub, the AI router, the warehouse service, the embedded deploy gateway and finally the HTTP server. Close releases them in reverse order. Run serves the handler (and an optional metrics listener) until its context is cancelled, then shuts down gracefully.

With mcp.enabled the authenticator also is the Claude connector's authorization server (auth.MCPOf), and the remote MCP endpoint (internal/mcpremote) is built on the same registry, storage, document store and gateway as the hub.

With Options.GatewayOnly only storage, a bearer-only authenticator and the deploy gateway are built (`backyard gateway`); mcp.* is then ignored.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App is a running Backyard instance.

func New

func New(ctx context.Context, cfg *config.Config, opts Options) (_ *App, err error)

New builds every component from cfg. On error everything built so far is released.

func (*App) Close

func (a *App) Close() error

Close releases all resources (idempotent). It is safe to call after Run.

func (*App) Handler

func (a *App) Handler() http.Handler

Handler returns the root handler.

func (*App) MetricsHandler

func (a *App) MetricsHandler() http.Handler

MetricsHandler returns the Prometheus handler (nil in gateway-only mode).

func (*App) Run

func (a *App) Run(ctx context.Context) error

Run listens on cfg.Server.Listen (and telemetry.metrics_listen) until ctx is cancelled, then shuts down gracefully within server.shutdown_timeout.

type Options

type Options struct {
	Logger *slog.Logger
	// DevSites maps site names to local directories served live (backyard dev).
	DevSites map[string]string
	// GatewayOnly serves only the deploy gateway (backyard gateway): no sites,
	// no site APIs, bearer-only auth, no database.
	GatewayOnly bool
	// Listener, if set, is used by Run instead of listening on
	// cfg.Server.Listen (tests, socket activation).
	Listener net.Listener
	// OnListen, if set, is called by Run with the bound address once the
	// server accepts connections.
	OnListen func(addr net.Addr)
	// contains filtered or unexported fields
}

Options tune App construction.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL