source

package
v0.0.0-...-7ddf83c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2014 License: MIT Imports: 8 Imported by: 0

Documentation

Index

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

func (*EnvSource) AllKeys

func (self *EnvSource) AllKeys() []string

func (*EnvSource) Bind

func (self *EnvSource) Bind(input ...string) (err error)

Essentially an environment variable specific alias.

func (*EnvSource) Get

func (self *EnvSource) Get(key string) (val interface{}, exists bool)

Gets an environment variable.

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{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL