Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/njkleiner/go-confusion
Simple configuration management for Go projects.
https://github.com/njkleiner/go-confusion
golang
Last synced: 20 days ago
JSON representation
Simple configuration management for Go projects.
- Host: GitHub
- URL: https://github.com/njkleiner/go-confusion
- Owner: njkleiner
- License: mit
- Created: 2020-12-23T13:14:15.000Z (about 4 years ago)
- Default Branch: develop
- Last Pushed: 2021-05-30T13:53:22.000Z (over 3 years ago)
- Last Synced: 2024-06-20T17:49:15.499Z (7 months ago)
- Topics: golang
- Language: Go
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# go-confusion
[![godoc](https://godocs.io/github.com/njkleiner/go-confusion?status.svg)](https://godocs.io/github.com/njkleiner/go-confusion)
Simple configuration management for Go projects. Inspired by [cristalhq/aconfig](https://github.com/cristalhq/aconfig).
## Install
`$ go get github.com/njkleiner/go-confusion`
## Usage
```go
package exampleimport (
"fmt""github.com/njkleiner/go-confusion"
"github.com/njkleiner/go-confusion/toml"
)type ExampleConfig struct {
Foo, Bar string
}func Example() {
opts := confusion.Options{
Prefix: "example",
Paths: []string{
"/etc",
"$XDG_CONFIG_HOME",
"$HOME/.config",
},
Loaders: map[string]confusion.Loader{
".toml": toml.Loader,
},
}config := ExampleConfig{}
// Loads the config file located at "$HOME/.config/example/config.toml"
path, err := confusion.LoadConfig("config.toml", opts, &config)if err != nil {
panic(err)
}fmt.Printf("loaded from %s: %#v", path, config)
}
```## Contributing
You can contribute to this project by [sending patches](https://git-send-email.io) to `[email protected]`. Pull Requests are also welcome.
## Authors
* [Noah Kleiner](https://github.com/njkleiner)
See also the list of [contributors](https://github.com/njkleiner/go-confusion/contributors) who participated in this project.
## License
This project is licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for details.