platform

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package platform is the public runtime façade a wrapper module imports to build and run the platform-api server. The split is clean — platform runs the server, pdk says what a plugin is and what it can reach.

This package deliberately re-exports nothing from pdk. A wrapper's main imports platform to construct and run the App; the packages that implement plugins import pdk directly, so every contract type has exactly one name and pdk's own documentation is what a plugin author reads. The façade works entirely in terms of that external surface and never exposes internal/plugin.

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 configured, ready-to-run platform-api server.

func New

func New(opts ...Option) (*App, error)

New builds an App from the given options. Configuration and logger resolve eagerly, so config/logger errors surface here rather than from Run.

func (*App) Run

func (a *App) Run() error

Run starts the server and blocks until it exits (signal or fatal error). Wrappers only ever supply external (pdk) plugins; built-ins are supplied directly by cmd/main.go, so the internal tier passed here is nil.

type Option

type Option func(*App)

Option configures an App. Options are applied in order; later options that set the same field win.

func WithConfig

func WithConfig(cfg *config.Server) Option

WithConfig supplies an already-built config, taking precedence over WithConfigPath.

func WithConfigPath

func WithConfigPath(path string) Option

WithConfigPath loads platform-api config from a TOML file (env > file > defaults). It points the shared config loader at the given path; the config is materialized in New. WithConfig takes precedence over this.

func WithConfigPaths added in v0.14.0

func WithConfigPaths(paths ...string) Option

WithConfigPaths loads platform-api config from one or more TOML files, merged in order with last-wins precedence (a key set in a later file overrides the same key from an earlier file). It is the repeatable form of WithConfigPath; the config is materialized in New. WithConfig takes precedence over this.

func WithLogger

func WithLogger(l *slog.Logger) Option

WithLogger supplies the logger. When omitted, one is derived from the config's log level and format.

func WithPlugin

func WithPlugin(plugins ...pdk.Plugin) Option

WithPlugin registers wrapper-owned extension modules — the one way a wrapper adds routes, scopes, and hooks. Each plugin implements pdk.Plugin and receives pdk.Deps in Init. Multiple calls accumulate; nil plugins are ignored.

Jump to

Keyboard shortcuts

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