bootstrap

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootstrapAndRun

func BootstrapAndRun(configPath, name, version string, builder appBuilder, opts ...BootstrapOption) error

BootstrapAndRun 对外暴露统一启动入口。

func ScanConf added in v0.2.1

func ScanConf[T any](rt *Runtime) (*T, error)

ScanConf 从 Runtime 的合并配置中扫描配置。 泛型参数 T 可为业务 conf protobuf message 或任意可反序列化结构体。

Types

type BootstrapOption

type BootstrapOption func(*bootstrapOptions)

BootstrapOption 配置启动行为的可选项。

func WithEnvPrefix

func WithEnvPrefix() BootstrapOption

WithEnvPrefix 启用环境变量前缀。 启用后,配置加载器会根据服务名推导前缀(如 iam.service → IAM_), 仅读取带前缀的环境变量覆盖配置。 默认不使用前缀,直接读取无前缀的环境变量。

type Runtime

type Runtime struct {
	Bootstrap *conf.Bootstrap
	Config    kconfig.Config
	Identity  SvcIdentity
	Logger    log.Logger
	// contains filtered or unexported fields
}

Runtime 聚合启动阶段产物与资源清理句柄。

func (*Runtime) Close

func (r *Runtime) Close()

Close 释放 Runtime 关联的外部资源。

type SvcIdentity

type SvcIdentity struct {
	Name     string
	Version  string
	ID       string
	Metadata map[string]string
}

SvcIdentity 定义服务实例身份信息。

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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