Skip to content
This repository was archived by the owner on Oct 12, 2020. It is now read-only.

xdefrag/viper-etcd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Viper Etcd

Build Status codecov Go Report Card

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.

Usage

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.

About

Advanced ETCD remote config provider for viper.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages