Documentation ¶
Overview ¶
Package config implements the functions, types, and interfaces for the module.
Package config implements the functions, types, and interfaces for the module.
Package config implements the functions, types, and interfaces for the module.
Package config implements the functions, types, and interfaces for the module.
Index ¶
- Variables
- type BuildFunc
- type Builder
- type Config
- func (c *Config) GetEnv(key string) (string, bool)
- func (c *Config) LoadFromFile(path string, opts ...KOption) error
- func (c *Config) LoadFromSource(cfg *configv1.SourceConfig, opts ...OptionSetting) error
- func (c *Config) Scan(v any) error
- func (c *Config) SetEnv(key, value string)
- func (c *Config) Setup(prefix string) error
- func (c *Config) Watch(key string, ob KObserver) error
- type Configure
- type Encoder
- type EnvVars
- type Factory
- type KConfig
- type KDecoder
- type KKeyValue
- type KMerge
- type KObserver
- type KOption
- type KReader
- type KResolver
- type KSource
- type KValue
- type KWatcher
- type Option
- type OptionSetting
- type Syncer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound defined error from kratos config package ErrNotFound = kratosconfig.ErrNotFound )
Functions ¶
This section is empty.
Types ¶
type BuildFunc ¶ added in v0.1.16
type BuildFunc func(*configv1.SourceConfig, ...OptionSetting) (KConfig, error)
BuildFunc is a function type that takes a KConfig and a list of Options and returns a Selector and an error.
func (BuildFunc) NewConfig ¶ added in v0.1.16
func (fn BuildFunc) NewConfig(cfg *configv1.SourceConfig, ss ...OptionSetting) (KConfig, error)
NewConfig is a method that implements the ConfigBuilder interface for ConfigBuildFunc.
type Builder ¶ added in v0.1.16
type Builder interface { Factory // RegisterConfigBuilder registers a config builder with the given name. RegisterConfigBuilder(string, Factory) }
Builder is an interface that defines a method for registering a config builder.
func NewBuilder ¶ added in v0.1.16
func NewBuilder() Builder
type Config ¶
type Config struct { Path string EnvPrefixes []string Builder Builder // contains filtered or unexported fields }
func (*Config) LoadFromFile ¶ added in v0.1.15
func (*Config) LoadFromSource ¶ added in v0.1.27
func (c *Config) LoadFromSource(cfg *configv1.SourceConfig, opts ...OptionSetting) error
type Configure ¶ added in v0.1.19
type Configure interface {
FromConfig(cfg *configv1.SourceConfig) error
}
type Factory ¶ added in v0.1.16
type Factory interface { // NewConfig creates a new config using the given KConfig and a list of Options. NewConfig(*configv1.SourceConfig, ...OptionSetting) (KConfig, error) }
Factory is an interface that defines a method for creating a new config.
type KConfig ¶ added in v0.1.18
type KConfig = kratosconfig.Config
Define types from kratos config package
func NewSourceConfig ¶ added in v0.1.17
NewSourceConfig returns a new config instance
type KDecoder ¶ added in v0.1.18
type KDecoder = kratosconfig.Decoder
Define types from kratos config package
type KKeyValue ¶ added in v0.1.18
type KKeyValue = kratosconfig.KeyValue
Define types from kratos config package
type KMerge ¶ added in v0.1.18
type KMerge = kratosconfig.Merge
Define types from kratos config package
type KObserver ¶ added in v0.1.18
type KObserver = kratosconfig.Observer
Define types from kratos config package
type KOption ¶ added in v0.1.18
type KOption = kratosconfig.Option
Define types from kratos config package
func WithResolveActualTypes ¶
WithResolveActualTypes enables resolving actual types
type KReader ¶ added in v0.1.18
type KReader = kratosconfig.Reader
Define types from kratos config package
type KResolver ¶ added in v0.1.18
type KResolver = kratosconfig.Resolver
Define types from kratos config package
type KSource ¶ added in v0.1.18
type KSource = kratosconfig.Source
Define types from kratos config package
type KValue ¶ added in v0.1.18
type KValue = kratosconfig.Value
Define types from kratos config package
type KWatcher ¶ added in v0.1.18
type KWatcher = kratosconfig.Watcher
Define types from kratos config package
type OptionSetting ¶ added in v0.1.17
type OptionSetting = func(s *Option)
OptionSetting is a function that takes a pointer to a KOption struct and modifies it.
func WithConfigure ¶ added in v0.1.19
func WithConfigure(cfg Configure) OptionSetting
func WithOptions ¶
func WithOptions(options ...KOption) OptionSetting
WithOptions sets the options field of the KOption struct.
type Syncer ¶ added in v0.1.16
type Syncer interface {
SyncConfig(*configv1.SourceConfig, any, ...OptionSetting) error
}
Syncer is an interface that defines a method for synchronizing a config.