https://github.com/sagikazarmark/viperx
Viper extensions
https://github.com/sagikazarmark/viperx
configuration go golang vault
Last synced: 7 months ago
JSON representation
Viper extensions
- Host: GitHub
- URL: https://github.com/sagikazarmark/viperx
- Owner: sagikazarmark
- License: mit
- Created: 2019-05-10T20:31:28.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-04-03T16:36:46.000Z (over 2 years ago)
- Last Synced: 2025-03-15T16:11:15.765Z (7 months ago)
- Topics: configuration, go, golang, vault
- Language: Go
- Size: 208 KB
- Stars: 32
- Watchers: 3
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ViperX: [Viper](https://github.com/spf13/viper) extensions
[](https://github.com/sagikazarmark/viperx/actions?query=workflow%3ACI)
[](https://codecov.io/gh/sagikazarmark/viperx)
[](https://goreportcard.com/report/github.com/sagikazarmark/viperx)

[](https://pkg.go.dev/mod/github.com/sagikazarmark/viperx)
[](https://app.fossa.com/projects/custom%2B8125%2Fviperx?ref=badge_shield)This library adds some extensions to the core [Viper](https://github.com/spf13/viper) package.
## Installation
```bash
$ go get github.com/sagikazarmark/viperx
```## Usage
### Remote config provider registry
Package `remote` provides a remote provider registry.
```go
package mainimport (
"github.com/spf13/viper"vaultremote "github.com/sagikazarmark/viperx/remote"
)func main() {
vaultremote.RegisterConfigProvider("vault", &myVaultProvider{})_ = viper.AddRemoteProvider("vault", "endpoint", "path")
}
```### Hashicorp Vault Remote config provider
```go
package mainimport (
"github.com/spf13/viper""github.com/sagikazarmark/viperx/remote/vault"
)func main() {
_ = viper.AddRemoteProvider("vault", "endpoint", "path")
viper.SetConfigType("json") // This is required for the vault provider_ = viper.ReadRemoteConfig()
}
```## Roadmap
- [ ] Add etcd remote provider support (Using Go CDK `secrets`?)
- [ ] Add consul remote provider support (Using Go CDK `secrets`?)
- [ ] Add a friendly (declarative?) API for defining configuration## Development
Contributions are welcome! :)
1. Clone the repository
1. Make changes on a new branch
1. If you changed any dependencies or added new packages run: `./pleasew tidy`
1. Run the test suite:
```bash
./pleasew test
./pleasew lint
```
1. Commit, push and open a PR## License
The MIT License (MIT). Please see [License File](LICENSE) for more information.
[](https://app.fossa.com/projects/custom%2B8125%2Fviperx?ref=badge_large)