component

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

Jump to

Keyboard shortcuts

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