Skip to content

Commit

Permalink
embed: not-update advertise client URL if user provided empty value
Browse files Browse the repository at this point in the history
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
  • Loading branch information
gyuho committed Mar 1, 2017
1 parent d3aebbf commit 823dfe9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions embed/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,13 @@ func (cfg Config) IsDefaultHost() (string, error) {
}

// UpdateDefaultClusterFromName updates cluster advertise URLs with default host.
// Non-empty 'acurl' means that user specified the advertise client URL, so
// there's no need to overwrite cfg.ACURLs.
// TODO: check whether fields are set instead of whether fields have default value
func (cfg *Config) UpdateDefaultClusterFromName(defaultInitialCluster string) {
func (cfg *Config) UpdateDefaultClusterFromName(acurl string, defaultInitialCluster string) {
defaultHost, defaultHostErr := cfg.IsDefaultHost()
defaultHostOverride := defaultHost == "" || defaultHostErr == nil
if (defaultHostOverride || cfg.Name != DefaultName) && cfg.InitialCluster == defaultInitialCluster {
if acurl == "" && (defaultHostOverride || cfg.Name != DefaultName) && cfg.InitialCluster == defaultInitialCluster {
cfg.InitialCluster = cfg.InitialClusterFromName(cfg.Name)
ip, _, _ := net.SplitHostPort(cfg.LCUrls[0].Host)
// if client-listen-url is 0.0.0.0, just use detected default host
Expand Down

0 comments on commit 823dfe9

Please sign in to comment.