Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 1 month 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 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-03T01:55:28.000Z (over 7 years ago)
- Last Synced: 2024-10-12T21:21:14.985Z (3 months 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
### DownloadThis package can be downloaded in standard go fashion
or vendored using tags.```console
go get github.com/opalmer/fangless
```### API Usage
```go
package mainimport (
"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 mainimport (
"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
}
```