:fishing_pole_and_fish: config
Convenient, injection-friendly YAML configuration.
Installation
go get -u github.com/forestnode-io/config
Note that config only supports the two most recent minor versions of Go.
Quick Start
type cfg struct {
Parameter string
}
base := strings.NewReader("module: {parameter: foo}")
override := strings.NewReader("module: {parameter: bar}")
provider, err := config.NewYAML(config.Source(base), config.Source(override))
if err != nil {
panic(err)
}
var c cfg
if err := provider.Get("module").Populate(&c); err != nil {
panic(err)
}
fmt.Printf("%+v\n", c)
Development Status: Stable
All APIs are finalized, and no breaking changes will be made in the 1.x series
of releases. Users of semver-aware dependency management systems should pin
config to ^1
.
Released under the MIT License.