Documentation ¶
Overview ¶
Package config allows a struct-loading approach to configuration. This is a modified version of the ucpconfig package
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetValue ¶
GetValue tries to look up an env var of the given name and then tries to look up the secret file of the same
func Load ¶
func Load(intf interface{}) error
Load the given pointer to struct with values from the environment and the /etc/secrets/ directory.
In order to make the struct load correctly, use struct tags to define the configuration name, if the configName struct tag is ommitted it will not attempt to look anything up. This is contrary to most serialization libraries like JSON which require a "-" struct tag to bypass deserialization.
type A struct { Port uint `configName:"PORT"` Name string `configName:"SERVICE_NAME"` Struct *myType }
The name will be given as defined to Getenv, and if that fails a lookup it's name is then munged to conform to the /etc/secrets filename structure and the file is attempted to be read.
func LoadConfigFile ¶
LoadConfigFile - Load the configuration values in the specified config file if it exists
Types ¶
This section is empty.