From b49c5e807dedb3fe0bb2b24050b191151986d737 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Wed, 13 Dec 2017 06:13:19 -0500 Subject: [PATCH] only check swim overrides when we're overriding --- cluster/config.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/cluster/config.go b/cluster/config.go index 1e12634462..86a20ba4b2 100644 --- a/cluster/config.go +++ b/cluster/config.go @@ -76,22 +76,19 @@ func ConfigSetup() { } func ConfigProcess() { + + // check settings in cluster section if !validMode(mode) { log.Fatal(4, "CLU Config: invalid cluster operating mode") } Mode = ModeType(mode) + // all further stuff is only relevant in multi mode if mode != ModeMulti { return } - var err error - swimBindAddr, err = net.ResolveTCPAddr("tcp", swimBindAddrStr) - if err != nil { - log.Fatal(4, "CLU Config: swim-bind-addr is not a valid TCP address: %s", err.Error()) - } - if httpTimeout == 0 { log.Fatal(4, "CLU Config: http-timeout must be a non-zero duration string like 60s") } @@ -110,7 +107,16 @@ func ConfigProcess() { Timeout: httpTimeout, } + // check settings in swim section if swimUseConfig != "manual" && swimUseConfig != "default-lan" && swimUseConfig != "default-local" && swimUseConfig != "default-wan" { log.Fatal(4, "CLU Config: invalid swim-use-config setting") } + + if swimUseConfig == "manual" { + var err error + swimBindAddr, err = net.ResolveTCPAddr("tcp", swimBindAddrStr) + if err != nil { + log.Fatal(4, "CLU Config: swim-bind-addr is not a valid TCP address: %s", err.Error()) + } + } }