A small configuration library for go application with a viper-like API, but with limited scope and no external dependency
It supports:
- reading a config in JSON or JSONC ( JSON with comments)
- setting default
config:=`{ "http_server": { "enabled": true, "host": "127.0.0.1" }}`boa.SetDefault("http_server.port", 80)
err:=boa.ParseConfig(strings.NewReader(config))
iferr!=nil {
log.Fatal(err)
}
srvHost:=boa.GetString("http_server.host")
srvPort:=boa.GetInt("http_server.port")
fmt.Printf("%s:%d", srvHost, srvPort)
// Output: 127.0.0.1:80