Update module spf13/viper to v1.7.0 (#494)
Update module spf13/viper to v1.7.0 Reviewed-on: https://kolaente.dev/vikunja/api/pulls/494
This commit is contained in:
31
vendor/github.com/spf13/viper/README.md
generated
vendored
31
vendor/github.com/spf13/viper/README.md
generated
vendored
@ -1,10 +1,13 @@
|
||||

|
||||

|
||||
|
||||
Go configuration with fangs!
|
||||
[](https://github.com/avelino/awesome-go#configuration)
|
||||
|
||||
[](https://github.com/spf13/viper)
|
||||
[](https://github.com/spf13/viper/actions?query=workflow%3ACI)
|
||||
[](https://gitter.im/spf13/viper?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://godoc.org/github.com/spf13/viper)
|
||||
[](https://goreportcard.com/report/github.com/spf13/viper)
|
||||
[](https://pkg.go.dev/mod/github.com/spf13/viper)
|
||||
|
||||
**Go configuration with fangs!**
|
||||
|
||||
Many Go projects are built using Viper including:
|
||||
|
||||
@ -400,7 +403,7 @@ in a Key/Value store such as etcd or Consul. These values take precedence over
|
||||
default values, but are overridden by configuration values retrieved from disk,
|
||||
flags, or environment variables.
|
||||
|
||||
Viper uses [crypt](https://github.com/xordataexchange/crypt) to retrieve
|
||||
Viper uses [crypt](https://github.com/bketelsen/crypt) to retrieve
|
||||
configuration from the K/V store, which means that you can store your
|
||||
configuration values encrypted and have them automatically decrypted if you have
|
||||
the correct gpg keyring. Encryption is optional.
|
||||
@ -412,7 +415,7 @@ independently of it.
|
||||
K/V store. `crypt` defaults to etcd on http://127.0.0.1:4001.
|
||||
|
||||
```bash
|
||||
$ go get github.com/xordataexchange/crypt/bin/crypt
|
||||
$ go get github.com/bketelsen/crypt/bin/crypt
|
||||
$ crypt set -plaintext /config/hugo.json /Users/hugo/settings/config.json
|
||||
```
|
||||
|
||||
@ -435,7 +438,7 @@ err := viper.ReadRemoteConfig()
|
||||
```
|
||||
|
||||
#### Consul
|
||||
You need to set a key to Consul key/value storage with JSON value containing your desired config.
|
||||
You need to set a key to Consul key/value storage with JSON value containing your desired config.
|
||||
For example, create a Consul key/value store key `MY_CONSUL_KEY` with value:
|
||||
|
||||
```json
|
||||
@ -454,6 +457,16 @@ fmt.Println(viper.Get("port")) // 8080
|
||||
fmt.Println(viper.Get("hostname")) // myhostname.com
|
||||
```
|
||||
|
||||
#### Firestore
|
||||
|
||||
```go
|
||||
viper.AddRemoteProvider("firestore", "google-cloud-project-id", "collection/document")
|
||||
viper.SetConfigType("json") // Config's format: "json", "toml", "yaml", "yml"
|
||||
err := viper.ReadRemoteConfig()
|
||||
```
|
||||
|
||||
Of course, you're allowed to use `SecureRemoteProvider` also
|
||||
|
||||
### Remote Key/Value Store Example - Encrypted
|
||||
|
||||
```go
|
||||
@ -728,14 +741,14 @@ Viper uses [github.com/mitchellh/mapstructure](https://github.com/mitchellh/maps
|
||||
|
||||
### Marshalling to string
|
||||
|
||||
You may need to marshal all the settings held in viper into a string rather than write them to a file.
|
||||
You may need to marshal all the settings held in viper into a string rather than write them to a file.
|
||||
You can use your favorite format's marshaller with the config returned by `AllSettings()`.
|
||||
|
||||
```go
|
||||
import (
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
// ...
|
||||
)
|
||||
)
|
||||
|
||||
func yamlStringSettings() string {
|
||||
c := viper.AllSettings()
|
||||
|
Reference in New Issue
Block a user