Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/feliixx/boa
minimalist configuration library for go
https://github.com/feliixx/boa
configuration golang json
Last synced: 9 days ago
JSON representation
minimalist configuration library for go
- Host: GitHub
- URL: https://github.com/feliixx/boa
- Owner: feliixx
- License: mit
- Created: 2022-04-13T04:26:51.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-19T05:14:12.000Z (over 2 years ago)
- Last Synced: 2024-12-10T06:25:26.604Z (2 months ago)
- Topics: configuration, golang, json
- Language: Go
- Homepage:
- Size: 11.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Go Report Card](https://goreportcard.com/badge/github.com/feliixx/boa)](https://goreportcard.com/report/github.com/feliixx/boa)
[![codecov](https://codecov.io/gh/feliixx/boa/branch/main/graph/badge.svg?token=NJ3F2CR3VA)](https://codecov.io/gh/feliixx/boa)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/feliixx/boa)](https://pkg.go.dev/github.com/feliixx/boa)## 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
```go
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
```