https://github.com/opalmer/fangless
Fangless is a package which wraps a viper configuration object to make it a bit safer.
https://github.com/opalmer/fangless
Last synced: 8 months ago
JSON representation
Fangless is a package which wraps a viper configuration object to make it a bit safer.
- Host: GitHub
- URL: https://github.com/opalmer/fangless
- Owner: opalmer
- License: mit
- Created: 2017-04-02T20:34:30.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-03T01:55:28.000Z (about 9 years ago)
- Last Synced: 2025-01-16T01:43:43.413Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fangless
Fangless is a small wrapper around [spf13's viper](https://github.com/spf13/viper)
package.
## Usage
### Download
This package can be downloaded in standard go fashion
or vendored using tags.
```console
go get github.com/opalmer/fangless
```
### API Usage
```go
package main
import (
"github.com/opalmer/fangless"
"github.com/spf13/viper"
)
func main() {
snake := fangless.New(viper.New())
}
```
The `snake` variable will provide access to Viper's
own read functions with read-only locks. You may also
call `snake.Set` or `snake.SetDefault` to set a value
safely inside of a goroutine. If additional control
is needed direct access is allowed too:
```go
package main
import (
"github.com/opalmer/fangless"
"github.com/spf13/viper"
)
func main() {
snake := fangless.New(viper.New())
v := snake.Viper() // locks the config
defer snake.Unlock()
// do stuff with v
}
```