Documentation
¶
Overview ¶
Package component provides env lifecycle integration for bootstrap.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Component ¶
func Component(file string, fs ...*embed.FS) bootstrap.IComponent
Component loads the TOML config file into the koanf singleton. Pass an embedded FS for single-binary deployments; omit it to load from disk.
Close is a no-op: the koanf singleton is a pure in-memory object with no resources to release.
This component must be passed as the first argument to bootstrap.New() so that the framework guarantees it is initialised before all other components.
Example ¶
ExampleComponent shows how env.Component() is used as the first argument to bootstrap.New(). It loads the TOML config file into the koanf singleton so that env.Env() is available to all subsequent components.
package main
import (
"fmt"
envComp "github.com/phcp-tech/common-library-golang/env/component"
)
func main() {
c := envComp.Component("testdata/config.toml")
fmt.Println(c != nil)
fmt.Println(c.Name())
}
Output: true env
Types ¶
This section is empty.