This is a Go package to parse a configuration file using JSON.
It's really simple (under 100 lines of code) and does nothing fancy. We wouldn't have bothered releasing it except that a few other projects we will be releasing depend on it.
Usage
Write your config file as a JSON object. For example:
{
"host_and_port": ":9556",
"environment": "production",
"priority_level": 20,
"alert_recipients": ["patrick", "gus"]
}
Load the config file:
config := jconfig.LoadConfig("/etc/super.conf")
Get some values out of it:
if config.GetString("environment") == "production" {
// ...
}
sender := NewSender(config.GetInt("priority_level"))
sender.Recipients = config.GetArray("alert_recipients")
That's all it does.