Change ClientAddr
to default to BindAddr
when not present.
#2786
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this change, it is now possible to only specify the
-bind
orbind_addr
attributes and get a functioning consul agent.There are two possible paths from this PR:
BindAddr
's default to{{ GetPrivateIP }}
, which will return an empty string and fail downstream if a private IP isn't available.I researched option #2 but put a pin in that because it brought a pile of additional work. The rough sketch of what I had in mind to satisfy option #2 would be to:
-listen
flag and config option which would contain one or more IP addresses that would be used for all services.-listen-http
,-listen-serf
that would be the more granular per-service overrides, but similar to-listen
, also zero or more.-advertise-addr
and-advertise-addr-wan
and tagged addressesThe thought experiment went like this (JSON5 used in this example for comments-sake):
But again, that was a big lift potentially and it was easier to just set two defaults. It'd be nice to clean this all up in a unified manner, however, and a thrust in this direction seemed like a reasonable approach.
Regarding the PR, I considered a fallback to
127.0.0.1
, but that never seemed like a good idea in a normal production environment. If someone wants127.0.0.1
, they should explicitly set it. Merge or discard as you see fit.