When running single-server mode, use public_cluster_addr if given (#904)

When running single-server mode, use public_cluster_addr if given

Right now you don't need to specify a controller address and we use the
cluster listener address; this allows overriding it to the
public_cluster_addr if one is given.

If `controllers` is specified we allow it to be either the cluster
listener or the public cluster address if one is specified before trying
to parse and use it.
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2021-02-03 08:58:42 -05:00
1 parent 3a3b664efb
commit 61ec5b47e4
2 files changed
+13

No files matched your search

+6
View File
@@ -4,6 +4,12 @@ Canonical reference for changes, improvements, and bugfixes for Boundary.
## Next
### New and Improved
* server: When running single-server mode and `controllers` is not specified in
the `worker` block, use `public_cluster_addr` if given
([PR](https://github.com/hashicorp/boundary/pull/904))
### Bug Fixes
* api: Fix nil pointer panic that could occur when using TLS
+7
View File
@@ -229,11 +229,18 @@ func (c *Command) Run(args []string) int {
if c.Config.Controller != nil {
switch len(c.Config.Worker.Controllers) {
case 0:
if c.Config.Controller.PublicClusterAddr != "" {
clusterAddr = c.Config.Controller.PublicClusterAddr
}
c.Config.Worker.Controllers = []string{clusterAddr}
case 1:
if c.Config.Worker.Controllers[0] == clusterAddr {
break
}
if c.Config.Controller.PublicClusterAddr != "" &&
c.Config.Worker.Controllers[0] == c.Config.Controller.PublicClusterAddr {
break
}
// Best effort see if it's a domain name and if not assume it must match
host, _, err := net.SplitHostPort(c.Config.Worker.Controllers[0])
if err != nil && strings.Contains(err.Error(), "missing port in address") {