Skip to content

Commit

Permalink
embed: use correct host for advertise-client-urls
Browse files Browse the repository at this point in the history
Fix #7348.

#7027 broke this.
It overwriting the advertise-client-urls' host with 'localhost'.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
  • Loading branch information
gyuho committed Mar 1, 2017
1 parent 17ae440 commit eb977f4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions embed/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ func (cfg *Config) UpdateDefaultClusterFromName(defaultInitialCluster string) {
// if client-listen-url is 0.0.0.0, just use detected default host
// otherwise, rewrite advertise-client-url with localhost
if ip != "0.0.0.0" {
_, acPort, _ := net.SplitHostPort(cfg.ACUrls[0].Host)
cfg.ACUrls[0] = url.URL{Scheme: cfg.ACUrls[0].Scheme, Host: fmt.Sprintf("localhost:%s", acPort)}
ahost, acPort, _ := net.SplitHostPort(cfg.ACUrls[0].Host)
cfg.ACUrls[0] = url.URL{Scheme: cfg.ACUrls[0].Scheme, Host: fmt.Sprintf("%s:%s", ahost, acPort)}
cfg.InitialCluster = cfg.InitialClusterFromName(cfg.Name)
}
}
Expand Down

0 comments on commit eb977f4

Please sign in to comment.