Documentation
¶
Overview ¶
Package app is the org bootstrap harness: catalog fill, env load, materialize, merge, sdi wire, and process Run.
Import github.com/omcrgnt/app/use in main to register DefaultApp and runner.Runner on unique.Global. Add an App field to AppResources only to override app config from env (ecfg block APP).
Pipeline (Pipeline, Bootstrap, Run):
fill → ecfg.LoadEnv → materialize → unique.Merge → Transform → sdi.Resolve
Breaking v0.21: Bootstrap returns *App; Pipeline.Registry is *unique.Registry; App.Serve has no registry arg; catalog fields are Configurable or ResourceFactory resources (nil *Resource ok for configurable slots).
Index ¶
Constants ¶
const DefaultShutdownTimeout = 5 * time.Second
Variables ¶
This section is empty.
Functions ¶
func DefaultApp ¶ added in v0.21.0
func DefaultApp() any
DefaultApp returns the system App resource for app/use registration.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the root application resource; runner.Runner is injected after sdi.Resolve.
func (*App) BuildConfig ¶
func (a *App) BuildConfig() (Materializer, error)
func (*App) GracePeriod ¶
type Configurable ¶ added in v0.21.0
type Configurable interface {
BuildConfig() (Materializer, error)
}
Configurable is a catalog resource slot (*Resource or value) that registers a spec for env + materialize. Nil *Resource is valid: fill calls BuildConfig on a zero instance of the field type.
type Materializer ¶ added in v0.21.0
Materializer is a config spec in the registry before materialize.
type Pipeline ¶
type Pipeline struct {
Registry *unique.Registry
EnvPrefix string
Transforms []res.TransformFunc
}
Pipeline configures fill → LoadEnv → materialize → merge → Transform → Resolve. Callers (typically main) must set every field explicitly; there are no package defaults.
type ResourceFactory ¶ added in v0.21.0
ResourceFactory is a catalog resource slot whose runtime instance is created at fill time. Nil *Resource is valid: fill calls NewResource on a zero instance of the field type.
type ShutdownTimeout ¶
ShutdownTimeout is the grace period for App.Serve after the run context is cancelled.
func (ShutdownTimeout) Usage ¶
func (ShutdownTimeout) Usage() string
func (ShutdownTimeout) Validate ¶
func (d ShutdownTimeout) Validate() error
type Spec ¶
type Spec struct {
ShutdownTimeout ShutdownTimeout
}
Spec is the app config; Spec.Build returns *App.