Help us shape the future of Go! Take the 2026 Go Developer Survey

composition

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: GPL-2.0, GPL-3.0 Imports: 37 Imported by: 0

Documentation

Overview

Package composition wires all vibekit services together and manages application lifecycle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Hub    *hub.Hub
	Server *server.Server
	// contains filtered or unexported fields
}

App holds all wired-up services for the vibekit server.

func Build

func Build(ctx context.Context, cfg *Config, staticFS fs.FS) (*App, error)

Build constructs all services and wires them together. staticFS is the embedded filesystem containing the compiled web UI. cfg is passed by pointer to avoid copying the Config struct at every invocation (it's only ever built once from the environment, then mutated is forbidden — callers must treat it as read-only).

func (*App) Run

func (a *App) Run() error

Run starts the HTTP server and blocks until shutdown. The server handles signal-based graceful shutdown internally.

func (*App) Shutdown

func (a *App) Shutdown()

Shutdown stops background services in reverse order.

type Config

type Config struct {
	WorkDir   string
	ConfigDir string
	CLIPath   string
	VapidSub  string
	// ToolsDir is the tools engine's install tree root (bin/, opt/,
	// npm/, python/) on the persistent volume.
	ToolsDir string
	// ToolCatalogPath is the compiled tool catalog baked into the
	// image (missing = degraded catalog search).
	ToolCatalogPath string
	// TrustedProxies is the set of reverse-proxy networks whose
	// X-Forwarded-For header webhttp.ClientIP is allowed to trust when
	// resolving the real client IP (access log + login/logout audit
	// logs). Parsed once from TRUSTED_PROXIES at startup. Empty/unset =
	// trust nothing = log the unspoofable socket peer (the spoof-safe
	// default for a directly-exposed deployment).
	TrustedProxies []*net.IPNet
	AuthConfig     auth.Config
}

Config holds all environment/flag values needed to build the app.

func ConfigFromEnv

func ConfigFromEnv() Config

ConfigFromEnv reads configuration from environment variables with sensible defaults.

Jump to

Keyboard shortcuts

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