hconf
extends the Hashicorp HCL library and is intended to be used as configuration file format.
hconf
is based around a configuration file with sections, and each section can have key/value pairs.
Given a configuration file like this:
section "autoupdate" {
release_channel = "test"
}
And a Golang structure like this:
type Config struct {
Autoupdate Autoupdate `hsection:"autoupdate"`
}
type Autoupdate struct {
ReleaseChannel hconf.String `hconf:"release_channel"`
}
This could be parsed like this:
hc := hconf.New(&hconf.Config{})
config := &Config{}
err := hc.DecodeFile(config, "path/to/config.conf")
// config.Autoupdate.ReleaseChannel now contains "test"
- Adding conditional
when
support based on predicates or local command execution to allow a more flexiable configuration file. Seepredicate.go
.
hconf
is licensed under the Mozilla Public License version 2.0. See the LICENSE file for details.