Documentation
¶
Index ¶
- type Config
- func (manager *Config) AllKeys() []string
- func (manager *Config) AllSettings() map[string]interface{}
- func (manager *Config) AutomaticEnv()
- func (manager *Config) BindEnv(input ...string) (err error)
- func (manager *Config) BindPFlag(key string, flag *pflag.Flag) (err error)
- func (manager *Config) Debug()
- func (self *Config) Find(key string) interface{}
- func (manager *Config) Get(key string) interface{}
- func (manager *Config) GetBool(key string) bool
- func (manager *Config) GetFloat64(key string) float64
- func (manager *Config) GetInt(key string) int
- func (manager *Config) GetString(key string) string
- func (manager *Config) GetStringMap(key string) map[string]interface{}
- func (manager *Config) GetStringMapString(key string) map[string]string
- func (manager *Config) GetStringSlice(key string) []string
- func (manager *Config) GetTime(key string) time.Time
- func (manager *Config) InConfig(key string) bool
- func (manager *Config) IsSet(key string) bool
- func (manager *Config) MergeAttributes(val interface{}) error
- func (manager *Config) ReadPaths(paths ...string) error
- func (manager *Config) Set(key string, value interface{})
- func (manager *Config) SetDefault(key string, value interface{})
- func (manager *Config) SetRootPath(path string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Manages key/value access and aliasing across multiple configuration sources.
func (*Config) AllKeys ¶
Returns all currently set keys, pruning ancestors and only showing the leaves.
func (*Config) AllSettings ¶
func (*Config) AutomaticEnv ¶
func (manager *Config) AutomaticEnv()
Have confer check ENV variables for all keys set in config, default & flags
func (*Config) BindEnv ¶
Binds a confer key to a ENV variable. ENV variables are case sensitive If only
func (*Config) BindPFlag ¶
Binds a configuration key to a command line flag:
pflag.Int("port", 8080, "The best alternative port") confer.BindPFlag("port", pflag.Lookup("port"))
func (*Config) Find ¶
Finds a value at a provided key, returning nil if the key does not exist. The order of precedence for configuration data is: 1. Program arguments. 2. Environment variables. 3. Config file data, overrides, and defaults.
func (*Config) Get ¶
Get returns an interface.. Must be typecast or used by something that will typecast
func (*Config) GetFloat64 ¶
func (*Config) GetStringMap ¶
func (*Config) GetStringMapString ¶
func (*Config) GetStringSlice ¶
func (*Config) MergeAttributes ¶
Merges data into the our attributes configuration tier from a struct.
func (*Config) ReadPaths ¶
Loads and sequentially + recursively merges the provided config arguments. Returns an error if any of the files fail to load, though this may be expecte in the case of search paths.
func (*Config) Set ¶
Explicitly sets a value. Will not override command line arguments or environment variables, as those sources have higher precedence.
func (*Config) SetDefault ¶
Set the default value for this key. Default only used when no value is provided by the user via flag, config or ENV.
func (*Config) SetRootPath ¶
Sets an optional root path. This frees you from having to specify a redundant prefix when calling ReadPaths() later.