Support setting datacenter when using consul remote state (#8102)

* Support setting datacenter when using consul remote state

Change-Id: I8c03f4058e9373f0de8fde7ce291ec552321cc60

* Add documentation for setting datacenter when using consul remote state

Change-Id: Ia62feea7a910a76308f0a5e7f9505c9a210e0339
This commit is contained in:
Guido Bakker 2016-08-11 12:58:20 +02:00 committed by Paul Stack
parent 66a14cb3b7
commit ee9ebe849f
2 changed files with 4 additions and 0 deletions

View File

@ -24,6 +24,9 @@ func consulFactory(conf map[string]string) (Client, error) {
if scheme, ok := conf["scheme"]; ok && scheme != "" {
config.Scheme = scheme
}
if datacenter, ok := conf["datacenter"]; ok && datacenter != "" {
config.Datacenter = datacenter
}
if auth, ok := conf["http_auth"]; ok && auth != "" {
var username, password string
if strings.Contains(auth, ":") {

View File

@ -44,5 +44,6 @@ The following configuration options / environment variables are supported:
* `scheme` - (Optional) Specifies what protocol to use when talking to the given
`address`, either `http` or `https`. SSL support can also be triggered
by setting then environment variable `CONSUL_HTTP_SSL` to `true`.
* `datacenter` - (Optional) The datacenter to use. Defaults to that of the agent.
* `http_auth` / `CONSUL_HTTP_AUTH` - (Optional) HTTP Basic Authentication credentials to be used when
communicating with Consul, in the format of either `user` or `user:pass`.