Documentation ¶
Overview ¶
Package config is an interface for dynamic configuration.
Index ¶
- Variables
- func Byte() []byte
- func Close() error
- func Fields() *field.Fields
- func Get(path ...string) reader.Value
- func Load(source ...source.Source) error
- func Scan(val Config) error
- func ServiceName() string
- func ServiceVersion() string
- func Sync() error
- type Config
- type Configurator
- type Option
- type Options
- type Source
- type Watcher
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Default Config Manager Default = NewConfig() )
Functions ¶
func ServiceName ¶ added in v1.0.0
func ServiceName() string
func ServiceVersion ¶ added in v1.0.0
func ServiceVersion() string
Types ¶
type Config ¶ added in v1.0.0
type Config interface {
Path() string
}
Config is set of config fields. "." is a level splitter. For example:
father.child
It means that config data's struct same as this.
{ "father": { "child": {xxx} } }
type Configurator ¶
type Configurator interface { // Load config sources Load(source ...source.Source) error // Force a source change set sync Sync() error // Stop the config loader/watcher Close() error // Bytes get merged config data Bytes() []byte // Scan to val Scan(val Config) error // Watch field change Watch(path ...string) (Watcher, error) // Get value through field Get(path ...string) reader.Value // Scanned fields Fields() *field.Fields }
Configurator is an interface abstraction for dynamic configuration
type Option ¶
type Option func(o *Options)
func WithLoader ¶
WithLoader sets the loader for manager config
func WithSource ¶
WithSource appends a source to list of sources
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package encoder handles source encoding formats
|
Package encoder handles source encoding formats |
Package loader manages loading from multiple sources
|
Package loader manages loading from multiple sources |
Package reader parses change sets and provides config values
|
Package reader parses change sets and provides config values |
Package source is the interface for sources
|
Package source is the interface for sources |
file
Package file is a file source.
|
Package file is a file source. |
Click to show internal directories.
Click to hide internal directories.