Skip to content

ScaleFT/hconf

Repository files navigation

hconf: HCL library for configuration files

GoDoc Build Status

hconf extends the Hashicorp HCL library and is intended to be used as configuration file format.

Configuration file API

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"

Future Ideas

  • Adding conditional when support based on predicates or local command execution to allow a more flexiable configuration file. See predicate.go.

License

hconf is licensed under the Mozilla Public License version 2.0. See the LICENSE file for details.

About

hconf is a Go library for configuration files

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages