Addresses are just addresses - no ports

Store address+port in an unexported field for ease-of-use
This commit is contained in:
Michael Schurter
2016-11-09 11:37:41 -08:00
parent 1893772f4b
commit 1304ba8b2d
6 changed files with 173 additions and 175 deletions

View File

@@ -196,7 +196,14 @@ func (c *Command) readConfig() *Config {
// Merge any CLI options over config file options
config = config.Merge(cmdConfig)
if ok := config.normalize(c.Ui.Error, dev); !ok {
// Set the version info
config.Revision = c.Revision
config.Version = c.Version
config.VersionPrerelease = c.VersionPrerelease
// Normalize binds, ports, addresses, and advertise
if err := config.normalizeAddrs(); err != nil {
c.Ui.Error(err.Error())
return nil
}
@@ -205,6 +212,17 @@ func (c *Command) readConfig() *Config {
return config
}
if config.Server.EncryptKey != "" {
if _, err := config.Server.EncryptBytes(); err != nil {
c.Ui.Error(fmt.Sprintf("Invalid encryption key: %s", err))
return nil
}
keyfile := filepath.Join(config.DataDir, serfKeyring)
if _, err := os.Stat(keyfile); err == nil {
c.Ui.Warn("WARNING: keyring exists but -encrypt given, using keyring")
}
}
// Parse the RetryInterval.
dur, err := time.ParseDuration(config.Server.RetryInterval)
if err != nil {