platform

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 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. It is the only package needed to start things; pdk is the package a wrapper builds its plugins against. The split is clean — platform runs the server, pdk says what a plugin is and what it can reach.

The façade works entirely in terms of the external surface (pdk) and never exposes internal/plugin. It aliases the two contract types so a wrapper can call them either platform.Plugin / platform.Deps or pdk.Plugin / pdk.Deps.

Index

Constants

View Source
const (
	// BeforePlatformChain is outermost — before CORS/auth, no identity yet.
	BeforePlatformChain = pdk.BeforePlatformChain
	// AfterPlatformChain is innermost — after auth + scope enforcement.
	AfterPlatformChain = pdk.AfterPlatformChain
)

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 ChainPosition

type ChainPosition = pdk.ChainPosition

ChainPosition selects where a middleware sits in the chain.

type Deps

type Deps = pdk.Deps

Deps is the set of platform capabilities passed to a plugin's Init. Alias of pdk.Deps.

type Middleware

type Middleware = pdk.Middleware

Middleware wraps one handler with another.

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 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.

type Plugin

type Plugin = pdk.Plugin

Plugin is what a wrapper implements — it receives pdk.Deps (capabilities), not raw repositories. Alias of pdk.Plugin.

type PositionedMiddleware

type PositionedMiddleware = pdk.PositionedMiddleware

PositionedMiddleware pairs a middleware with its chain position.

Jump to

Keyboard shortcuts

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