Skip to content

Commit

Permalink
Fix token usage in consul input plugin (influxdata#3375)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergei Smolianinov committed Oct 23, 2017
1 parent 77cc071 commit 8dcc26b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions plugins/inputs/consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ func (c *Consul) createAPIClient() (*api.Client, error) {
config.Datacenter = c.Datacentre
}

if c.Token != "" {
config.Token = c.Token
}

if c.Username != "" {
config.HttpAuth = &api.HttpBasicAuth{
Username: c.Username,
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/consul/consul_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var sampleChecks = []*api.HealthCheck{
},
}

func TestGatherHealtCheck(t *testing.T) {
func TestGatherHealthCheck(t *testing.T) {
expectedFields := map[string]interface{}{
"check_name": "foo.health",
"status": "passing",
Expand Down

0 comments on commit 8dcc26b

Please sign in to comment.