libconfig
is a Go library that provides a simple method for populating a struct with data from environment variables.
libconfig
provides the following:
- Parsing to built-in types
- Parsing to slices and pointers
- Support defaults, optionals, base64, and json
- 100% code coverage
libconfig
does not and will not support these scenarios:
- Config reloading: This is the work of deployment, canary releases, and blue/green environments.
- Loading config from a file: Config should come from the environment only so that all environments (local, dev, prod, etc.) use the same code paths.
- gonfig is a lightweight parser of JSON and env vars.
- Stært can be used alone or with Flæg to provide config parsing from the command line, TOML, and key-value stores using libkv.
- Viper is a feature-filled library with support for defaults, various formats (including JSON, TOML, and YAML), watching, and more.