Advanced ETCD remote config provider for Viper. Default remote config needs json on specific key, this one recursively get all nested key-values.
Attention! This remote provider doesn't support SecretKeyring. Crypt that Viper used for encryption is abandoned and doesn't work well with latest GPG versions. BUT you can use custom decoder.
Instead of requiring Viper's default remote package, initialize RemoteConfig by yourself like this:
import (
"github.com/xdefrag/viper-etcd/remote"
"github.com/spf13/viper"
)
func init() {
viper.RemoteConfig = &remote.Config{
Username: "user",
Password: "pass", // etcd credentials if any
Decoder: &decode{}, // struct with remote.Decoder interface:
// type Decoder interface {
// Decode(io.Reader) (interface{}, error)
// }
// Set your encryption or serialization tool here.
}
}
And that's it! More details in example.