Documentation
¶
Index ¶
- func GetBootstrapConfig() *conf.Bootstrap
- func ListFactories() []string
- func LoadBootstrapConfig(configPath string) error
- func LoadRemoteConfigSourceConfigs(configPath string) (error, *conf.RemoteConfig)
- func MustRegisterFactory(name Type, f Factory)
- func NewConfigProvider(configPath string) (config.Config, error)
- func NewFileConfigSource(filePath string) config.Source
- func NewProvider(cfg *conf.RemoteConfig) (config.Source, error)
- func RegisterConfig(c proto.Message)
- func RegisterFactory(name Type, f Factory) error
- type Factory
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBootstrapConfig ¶
func LoadBootstrapConfig ¶
LoadBootstrapConfig 加载程序引导配置
func LoadRemoteConfigSourceConfigs ¶
func LoadRemoteConfigSourceConfigs(configPath string) (error, *conf.RemoteConfig)
LoadRemoteConfigSourceConfigs 加载远程配置源的本地配置
func MustRegisterFactory ¶
MustRegisterFactory 等同于 RegisterFactory,但在出错时 panic(适用于 init)。
func NewConfigProvider ¶
NewConfigProvider 创建一个配置
func NewFileConfigSource ¶
NewFileConfigSource 创建一个本地文件配置源
func NewProvider ¶
func NewProvider(cfg *conf.RemoteConfig) (config.Source, error)
NewProvider 使用指定 name 的 Factory 和 cfg 创建 Provider 实例。
func RegisterConfig ¶
RegisterConfig 注册配置(去重、并发安全) 传入值应为指针类型,例如 &conf.SomeConfig{}
func RegisterFactory ¶
RegisterFactory 注册一个名为 name 的 Factory。 name 不能为空且不可重复;f 不能为 nil。
Types ¶
type Factory ¶
type Factory func(cfg *conf.RemoteConfig) (config.Source, error)
Factory 根据传入的配置创建一个 Provider 实例。
type Type ¶
type Type string
const ( // TypeLocalFile is the local file config type. TypeLocalFile Type = "file" // TypeApollo is the apollo remote config type. TypeApollo Type = "apollo" // TypeConsul is the consul remote config type. TypeConsul Type = "consul" // TypeEtcd is the etcd remote config type. TypeEtcd Type = "etcd" // TypeKubernetes is the kubernetes remote config type. TypeKubernetes Type = "kubernetes" // TypeNacos is the nacos remote config type. TypeNacos Type = "nacos" // TypePolaris is the polaris remote config type. TypePolaris Type = "polaris" )
Click to show internal directories.
Click to hide internal directories.