Fix ACL token usage in consul input plugin (#3376)

(cherry picked from commit d2f9fc7d8c)
This commit is contained in:
Sergei Smolianinov
2017-10-23 12:37:30 -07:00
committed by Daniel Nelson
parent c44b4fcc89
commit 0dd3b0507b
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -69,6 +69,10 @@ func (c *Consul) createAPIClient() (*api.Client, error) {
config.Datacenter = c.Datacentre config.Datacenter = c.Datacentre
} }
if c.Token != "" {
config.Token = c.Token
}
if c.Username != "" { if c.Username != "" {
config.HttpAuth = &api.HttpBasicAuth{ config.HttpAuth = &api.HttpBasicAuth{
Username: c.Username, Username: c.Username,
+1 -1
View File
@@ -20,7 +20,7 @@ var sampleChecks = []*api.HealthCheck{
}, },
} }
func TestGatherHealtCheck(t *testing.T) { func TestGatherHealthCheck(t *testing.T) {
expectedFields := map[string]interface{}{ expectedFields := map[string]interface{}{
"check_name": "foo.health", "check_name": "foo.health",
"status": "passing", "status": "passing",