Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Token support for Consul #747

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions backends/client.go
Expand Up @@ -47,6 +47,7 @@ func New(config Config) (StoreClient, error) {
config.BasicAuth,
config.Username,
config.Password,
config.AuthToken,
)
case "etcd":
// Create the etcd client upfront and use it for the life of the process.
Expand Down
5 changes: 4 additions & 1 deletion backends/consul/client.go
Expand Up @@ -13,7 +13,7 @@ type ConsulClient struct {
}

// NewConsulClient returns a new client to Consul for the given address
func New(nodes []string, scheme, cert, key, caCert string, basicAuth bool, username string, password string) (*ConsulClient, error) {
func New(nodes []string, scheme, cert, key, caCert string, basicAuth bool, username string, password string, authToken string) (*ConsulClient, error) {
conf := api.DefaultConfig()

conf.Scheme = scheme
Expand All @@ -36,6 +36,9 @@ func New(nodes []string, scheme, cert, key, caCert string, basicAuth bool, usern
if caCert != "" {
conf.TLSConfig.CAFile = caCert
}
if authToken != "" {
conf.Token = authToken
}

client, err := api.NewClient(conf)
if err != nil {
Expand Down