bootstrap

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package bootstrap implements the functions, types, and interfaces for the module.

Package bootstrap implements the functions, types, and interfaces for the module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadBootstrapConfig added in v0.2.6

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

LoadBootstrapConfig loads the bootstrapv1.Bootstrap definition from a local bootstrap configuration file. This function is the first step in the configuration process. The temporary config used to load the sources is closed internally.

func LoadConfig added in v0.2.6

func LoadConfig(bootstrapPath string, opts ...Option) (interfaces.StructuredConfig, error)

LoadConfig creates a new configuration decoder instance. It orchestrates the entire configuration decoding process, following a clear, layered approach.

func New

func New(bootstrapPath string, opts ...Option) (interfaces.Bootstrapper, error)

New creates a new component provider, which is the main entry point for application startup. It orchestrates the entire process of configuration loading and component initialization. It now returns the interfaces.Bootstrapper interface.

Types

type ComponentFactory added in v0.2.6

type ComponentFactory = interfaces.ComponentFactory

ComponentFactory is a function that creates a component instance. It receives the configuration decoder and the component provider, allowing for configuration-driven instantiation and dependency resolution. This is an alias for interfaces.ComponentFactoryFunc for consistency.

type ConfigLoadOptions added in v0.2.6

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

ConfigLoadOptions holds configuration for the LoadConfig function.

func FromConfigLoadOptions added in v0.2.6

func FromConfigLoadOptions(opts ...Option) *ConfigLoadOptions

type ConfigTransformFunc added in v0.2.6

type ConfigTransformFunc func(kratosconfig.Config) (interfaces.Config, error)

ConfigTransformFunc is a function type that implements the ConfigTransformer interface.

func (ConfigTransformFunc) Transform added in v0.2.6

Transform implements the ConfigTransformer interface for ConfigTransformFunc.

type ConfigTransformer added in v0.2.6

type ConfigTransformer interface {
	Transform(interfaces.Config) (interfaces.StructuredConfig, error)
}

ConfigTransformer defines an interface for custom transformation of kratosconfig.Config to interfaces.Config.

type Option added in v0.1.0

type Option = options.Option

Option configures the New function.

func WithAppInfo added in v0.2.6

func WithAppInfo(info *interfaces.AppInfo) Option

WithAppInfo provides the application's metadata to the provider. This is a required option for New.

func WithComponent added in v0.2.6

func WithComponent(key string, factory ComponentFactory) Option

WithComponent registers a component factory to be used during bootstrap.

func WithConfig added in v0.2.6

func WithConfig(cfg interfaces.Config) Option

WithConfig allows providing a custom interfaces.Config implementation. WithCond this option is used, LoadConfig will return the provided config directly, bypassing the default Kratos config creation and file loading.

func WithConfigTransformer added in v0.2.6

func WithConfigTransformer(transformer ConfigTransformer) Option

WithConfigTransformer allows providing an object that implements the ConfigTransformer interface, or a function of type ConfigTransformFunc. This provides a flexible way to customize the creation of interfaces.Config from kratosconfig.Config.

func WithDefaultPaths added in v0.2.6

func WithDefaultPaths(paths map[string]string) Option

WithDefaultPaths provides a default path map for components. This map is used as a base and can be overridden by paths defined in the bootstrap file.

type Options added in v0.1.56

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

Options holds configuration for the New function.

func FromOptions added in v0.2.6

func FromOptions(opts ...Option) *Options

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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