Documentation ¶
Index ¶
- type ConfigSource
- func (self *ConfigSource) AllKeys() []string
- func (self *ConfigSource) FromStringMap(data map[string]interface{})
- func (self *ConfigSource) Get(key string) (val interface{}, exists bool)
- func (self *ConfigSource) Set(key string, val interface{})
- func (self *ConfigSource) ToStringMap() map[string]interface{}
- func (self *ConfigSource) UpdateIndices()
- type Configger
- type EnvSource
- type PFlagSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigSource ¶
type ConfigSource struct {
// contains filtered or unexported fields
}
Manages key/value access for a specific configuration source. Delegated to by the over-arching config management functions that are aware of multiple config sources and their precedence.
func NewConfigSource ¶
func NewConfigSource() *ConfigSource
Create a new case-insensitive, aliasable config map.
func (*ConfigSource) AllKeys ¶
func (self *ConfigSource) AllKeys() []string
Returns all the keys for this specific configuration source.
func (*ConfigSource) FromStringMap ¶
func (self *ConfigSource) FromStringMap(data map[string]interface{})
Replaces our configuration data with the provided stringmap, without merging.
func (*ConfigSource) Get ¶
func (self *ConfigSource) Get(key string) (val interface{}, exists bool)
Get the value at a key. Case-insensitive, but preserving.
func (*ConfigSource) Set ¶
func (self *ConfigSource) Set(key string, val interface{})
Set a key in a case insensitive manner.
func (*ConfigSource) ToStringMap ¶
func (self *ConfigSource) ToStringMap() map[string]interface{}
Returns data as a string map.
func (*ConfigSource) UpdateIndices ¶
func (self *ConfigSource) UpdateIndices()
Index every key/value pair inside of this config sources's data.
type Configger ¶
type Configger interface { // Get a value. Get(key string) (val interface{}, exists bool) // Set a value. Set(key string, val interface{}) // Set data from a map[string]interface{}. FromStringMap(data map[string]interface{}) // Merge a map[string]interface{} into existing data. ToStringMap() map[string]interface{} }
Abstract various configuration sources into something that can get and set values, as well as return all of it's currently configured keys.
type EnvSource ¶
type EnvSource struct {
// contains filtered or unexported fields
}
A configuration data source that that reads environment variables.
func NewEnvSource ¶
func NewEnvSource() *EnvSource
type PFlagSource ¶
type PFlagSource struct {
// contains filtered or unexported fields
}
A configuration source for pflags.
func NewPFlagSource ¶
func NewPFlagSource() *PFlagSource
func (*PFlagSource) Get ¶
func (self *PFlagSource) Get(key string) (interface{}, bool)
func (*PFlagSource) Set ¶
func (self *PFlagSource) Set(key string, val interface{})