bootstrap

package
v0.2.19 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadBootstrapConfig

func LoadBootstrapConfig(bootstrapPath string, prefixes ...string) (*bootstrapv1.Bootstrap, error)

func LoadConfig

func LoadConfig(bootstrapPath string, providerOpts *ProviderOptions) (*bootstrapv1.Bootstrap, runtimeconfig.KConfig, error)

LoadConfig creates a new configuration decoder instance.

func SourceWithFile

func SourceWithFile(path string) *sourcev1.SourceConfig

Types

type ConfigTransformFunc

type ConfigTransformFunc func(runtimeconfig.KConfig) (any, error)

ConfigTransformFunc is a function type that implements the ConfigTransformer interface.

func (ConfigTransformFunc) Transform

func (f ConfigTransformFunc) Transform(config runtimeconfig.KConfig) (any, error)

Transform implements the ConfigTransformer interface for ConfigTransformFunc.

type ConfigTransformer

type ConfigTransformer interface {
	Transform(runtimeconfig.KConfig) (any, error)
}

ConfigTransformer defines an interface for custom transformation of KConfig to a business configuration object.

type Option

type Option = options.Option

func WithConfig

func WithConfig(cfg any) Option

func WithConfigTarget

func WithConfigTarget(target any) Option

func WithConfigTransformer

func WithConfigTransformer(transformer ConfigTransformer) Option

func WithDirectly

func WithDirectly(directly bool) Option

func WithFrameworkOptions

func WithFrameworkOptions(opts ...options.Option) Option

func WithPathResolver

func WithPathResolver(fn func(string) string) Option

func WithPrefixes

func WithPrefixes(prefixes ...string) Option

func WithProviderOptions

func WithProviderOptions(opts ...Option) Option

func WithRawOptions

func WithRawOptions(opts ...kratosconfig.Option) Option

type PathResolverFunc

type PathResolverFunc func(path string) string

PathResolverFunc defines the signature for a function that resolves a configuration path.

type ProviderOptions

type ProviderOptions struct {
	// contains filtered or unexported fields
}

func FromOptions

func FromOptions(opts ...Option) *ProviderOptions

type Result

type Result interface {
	// Bootstrap [Source Phase] Returns the strong-typed bootstrap metadata (sources, service info, etc.)
	Bootstrap() *bootstrapv1.Bootstrap

	// Config [Binding Phase] Returns the final decoded business configuration (any type).
	Config() any

	// Decoder [Operations] Returns the enhanced configuration loader (follows Kratos design).
	// It provides rich operations like Value(), Watch(), and Scan().
	Decoder() config.KConfig

	// ConfigPath returns the physical path of the loaded configuration file.
	ConfigPath() string
}

Result defines the unified contract for the bootstrap engine output.

func New

func New(bootstrapPath string, opts ...Option) (res Result, err error)

New creates a new component provider, which is the main entry point for application startup. It orchestrates the entire process of configuration loading. It now returns the Result interface, which contains configuration-related data and the raw App protobuf message.

Jump to

Keyboard shortcuts

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