Documentation ¶
Overview ¶
Package config implements a simple global configuration system that supports a file with key=value pairs and environment variables. Note that the config system is global.
This package is intended to be used for small daemons: some configuration file is optionally populated at program start, then this is used to transparently look up configuration values from either that file or the environment.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get retrieves a value from either a configuration file or the environment. Note that values from a file will override environment variables.
func GetDefault ¶
GetDefault retrieves a value from either a configuration file or the environment. Note that value from a file will override environment variables. If a value isn't found (e.g. Get returns an empty string), the default value will be used.
func LoadFile ¶
LoadFile scans the file at path for key=value pairs and adds them to the configuration.
func Require ¶
Require retrieves a value from either a configuration file or the environment. If the key isn't present, it will call log.Fatal, printing the missing key.
func SetEnvPrefix ¶
func SetEnvPrefix(pfx string)
SetEnvPrefix sets the prefix for all environment variables; it's assumed to not be needed for files.
Types ¶
This section is empty.