Skip to content

Latest commit

 

History

History
41 lines (27 loc) · 983 Bytes

README.md

File metadata and controls

41 lines (27 loc) · 983 Bytes

Go Report Card codecov PkgGoDev

boa

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

example

config := `
{
  "http_server": {
    "enabled": true,
    "host": "127.0.0.1"
  }
}`

boa.SetDefault("http_server.port", 80)

err := boa.ParseConfig(strings.NewReader(config))
if err != 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