github.com/XMLHexagram/emp (go): Package emp exposes functionality to convert environment value into a struct.  The Go structure can be arbitrarily complex, containing slices, other structs, etc. and the parser will properly parse the environment value and populate the values into the native struct.  See the examples to see what the parser is capable of.  The simplest function to start with is Parser.  When decoding to a struct, emp will use the field name by default to perform the mapping. For example, if a struct has a field "DATABASE_URL" then emp will look for a key in the environment of "DATABASE_URL" (case-sensitive).  You can change the behavior of emp by using struct tags. The default struct tag that emp looks for is "emp" but you can customize it using Config.  To rename the key that emp looks for, use the "emp" tag and set a value directly. For example, to change the "DATABASE_URL" example above to "DATABASE_DSN":  By default, Embedded structs are treated as prefix by their name. emp:  With environment value:  Will be converted to:  Config has a field that changes the behavior of emp to disable auto prefix.  Since unexported (private) struct fields cannot be set outside the package where they are defined, the parser will simply skip them.  For this output type definition:  Using this as environment value:  The following struct will be parsed:  emp is highly configurable. See the Config struct for other features and options that are supported.
Keywords: environment-variables|go|golang