Discover Packages
github.com/wolfbolin/bolbox
pkg
configs
package
Version:
v0.2.0-alpha.4
Opens a new window with list of versions in this module.
Published: Mar 6, 2026
License: Apache-2.0
Opens a new window with license information.
Imports: 8
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
View Source
var (
ErrConfNotExist = errors .New ("Config key is not exist.")
ErrConfValueSet = errors .New ("Config value can not be set.")
ErrParseFlags = errors .New ("Parse command flags error.")
ErrPrintUsage = errors .New ("User request to print usage.")
)
func (c *Config ) OnChange(callback func(any ))
OnChange 注册配置变更回调函数
const (
FlowEnv Flow = "env"
FlowFlag Flow = "flag"
)
Manager 配置管理器,支持从环境变量、命令行参数和动态映射中加载配置
优先级:默认值 < 环境变量 < 命令行参数 < 动态映射
NewManager 创建配置管理器,自动解析环境变量和命令行参数
ParseMap 从map中解析并更新配置值,键为字段名(区分大小写)
type Options struct {
ExitOnHelp bool
ParseFlows []Flow
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.