bootstrap

package
v2.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package bootstrap wires the configuration to the life-cycle phases.

It is a package of its own because of the direction of the imports, not because the code wants one. The trigger needs both sdk.Runtime and sdk/config, and neither of those can hold it: sdk cannot import sdk/config, because sdk/config's own test imports sdk and Go refuses the cycle that closes; sdk/config cannot import sdk, because sdk pulls in the whole of sdk/runtime - gin, casbin, gorm, cron - and sdk/config is what sdk/contract/actions depends on, which is the surface an application is meant to be able to use on its own. A leaf package that both of them can be imported by costs nothing to anybody who does not call it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupConfig

func SetupConfig(s source.Source, fs ...func())

SetupConfig loads the configuration, runs fs, and then announces that the resources they built are ready.

It is config.Setup plus the AfterResource phase, and it exists so that the order is core's to keep rather than something every call site has to remember. The announcement goes last, after every callback in fs has run: the phase means "the database, the cache and the queue are ready", and a hook that gets it before the callbacks that build them is worse than no hook at all. Because fs is what config re-runs on a reload, the announcement repeats there too, which is what AfterResource is for.

config.Setup itself deliberately does not announce anything. Only the command that serves traffic should: a migration or a config-dump command that started queue consumers and warmed caches on its way to doing something else would be doing the wrong thing quietly.

Types

This section is empty.

Jump to

Keyboard shortcuts

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