Documentation
¶
Overview ¶
Package config is a config file parser.
A note on usage: Due to the fact that we use the reflect package, you must pass in the struct for which you want to parse config keys using all exported fields, or this config package cannot set those fields.
Key names are case insensitive.
For an example of using this package, see the test(s).
For the types that we support parsing out of the struct, refer to the populateConfig() function.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfig ¶
GetConfig reads a config file and populates a struct with what is read.
We use the reflect package to populate the struct from the config.
Currently every member of the struct must have had a value set in the config. That is, every config option is required.
func PopulateStruct ¶
PopulateStruct takes values read from a config as a string map, and uses them to populate a struct. The values will be converted to the struct's types as necessary.
To understand the use of reflect in this function, refer to the article Laws of Reflection, or the documentation of the reflect package.
func ReadStringMap ¶
ReadStringMap a config file and returns the keys and values in a map where keys and values are strings.
The config file syntax is: key = value
Lines may be commented if they begin with a '#' with only whitespace or no whitespace in front of the '#' character. Lines currently MAY NOT have trailing '#' to be treated as comments.
Types ¶
This section is empty.