Merge pull request #2786 from hashicorp/f-client-addr-fallback

Change `ClientAddr` to default to `BindAddr` when not present.
This commit is contained in:
Sean Chittenden 2017-03-06 12:31:11 -08:00 committed by GitHub
commit db4f40f6f0
3 changed files with 16 additions and 5 deletions

View File

@ -264,6 +264,12 @@ func (c *Command) readConfig() *Config {
} }
} }
// If the client address is empty, default to using the value specified by the
// bind address.
if config.ClientAddr == "" {
config.ClientAddr = config.BindAddr
}
// Ensure all endpoints are unique // Ensure all endpoints are unique
if err := config.verifyUniqueListeners(); err != nil { if err := config.verifyUniqueListeners(); err != nil {
c.Ui.Error(fmt.Sprintf("All listening endpoints must be unique: %s", err)) c.Ui.Error(fmt.Sprintf("All listening endpoints must be unique: %s", err))

View File

@ -742,7 +742,6 @@ func DefaultConfig() *Config {
Datacenter: consul.DefaultDC, Datacenter: consul.DefaultDC,
Domain: "consul.", Domain: "consul.",
LogLevel: "INFO", LogLevel: "INFO",
ClientAddr: "127.0.0.1",
BindAddr: "0.0.0.0", BindAddr: "0.0.0.0",
Ports: PortConfig{ Ports: PortConfig{
DNS: 8600, DNS: 8600,

View File

@ -115,8 +115,9 @@ will exit with an error at startup.
[`-bind` command-line flag](#_bind), and if this is not specified, the `-bind` option is used. This is available in Consul 0.7.1 and later. [`-bind` command-line flag](#_bind), and if this is not specified, the `-bind` option is used. This is available in Consul 0.7.1 and later.
* <a name="_client"></a><a href="#_client">`-client`</a> - The address to which * <a name="_client"></a><a href="#_client">`-client`</a> - The address to which
Consul will bind client interfaces, including the HTTP and DNS servers. By default, Consul will bind client interfaces, including the HTTP and DNS servers. When
this is "127.0.0.1", allowing only loopback connections. not specified, the default value is the same as the [`_bind` command-line
flag](#_bind) address (prior to 0.8 the default value was `127.0.0.1`).
* <a name="_config_file"></a><a href="#_config_file">`-config-file`</a> - A configuration file * <a name="_config_file"></a><a href="#_config_file">`-config-file`</a> - A configuration file
to load. For more information on to load. For more information on
@ -586,8 +587,13 @@ Consul will not enable TLS for the HTTP API unless the `https` port has been ass
reduce write pressure. If a check ever changes state, the new state and associated reduce write pressure. If a check ever changes state, the new state and associated
output is synchronized immediately. To disable this behavior, set the value to "0s". output is synchronized immediately. To disable this behavior, set the value to "0s".
* <a name="client_addr"></a><a href="#client_addr">`client_addr`</a> Equivalent to the * <a name="client_addr"></a><a href="#client_addr">`client_addr`</a> Equivalent
[`-client` command-line flag](#_client). to the [`-client` command-line flag](#_client). When not specified, the
default value is the same as the [`bind_addr`](#bind_addr) address (prior to
`0.8` the default value was `127.0.0.1`). It is not normally necessary to
specify this value, however, may be necessary in more complex setups where
agents are NATed or when an agent is running in client and server mode (common
in development).
* <a name="datacenter"></a><a href="#datacenter">`datacenter`</a> Equivalent to the * <a name="datacenter"></a><a href="#datacenter">`datacenter`</a> Equivalent to the
[`-datacenter` command-line flag](#_datacenter). [`-datacenter` command-line flag](#_datacenter).