From 6e46e56b21585e5a96b7e202e6122e1663c935d8 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Mon, 14 Dec 2015 21:13:17 -0500 Subject: [PATCH] Ensure advertise address detection runs without a specified HA backend Ping #840 --- command/server.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/command/server.go b/command/server.go index 5927b1b6db..93baec7cf6 100644 --- a/command/server.go +++ b/command/server.go @@ -116,6 +116,7 @@ func (c *ServerCommand) Run(args []string) int { coreConfig := &vault.CoreConfig{ Physical: backend, + AdvertiseAddr: config.Backend.AdvertiseAddr, HAPhysical: nil, AuditBackends: c.AuditBackends, CredentialBackends: c.CredentialBackends, @@ -147,7 +148,14 @@ func (c *ServerCommand) Run(args []string) int { } // Attempt to detect the advertise address possible - if detect, ok := coreConfig.HAPhysical.(physical.AdvertiseDetect); ok && coreConfig.AdvertiseAddr == "" { + var detect physical.AdvertiseDetect + var ok bool + if coreConfig.HAPhysical != nil { + detect, ok = coreConfig.HAPhysical.(physical.AdvertiseDetect) + } else { + detect, ok = coreConfig.Physical.(physical.AdvertiseDetect) + } + if ok && coreConfig.AdvertiseAddr == "" { advertise, err := c.detectAdvertise(detect, config) if err != nil { c.Ui.Error(fmt.Sprintf("Error detecting advertise address: %s", err))