etcdmain: fix that advertise-client-urls is required in proxy mode

etcd proxy doesn't need to set advertise-client-urls because the flag is
not used.
release-2.1
Yicheng Qin 2015-06-10 15:06:49 -07:00
parent 30db41e031
commit cf7c83b304
1 changed files with 6 additions and 2 deletions

View File

@ -269,9 +269,13 @@ func (cfg *config) Parse(arguments []string) error {
if err != nil {
return err
}
// when etcd runs in member mode user needs to set -advertise-client-urls if -listen-client-urls is set.
if cfg.proxy.String() != proxyFlagOn {
if flags.IsSet(cfg.FlagSet, "listen-client-urls") && !flags.IsSet(cfg.FlagSet, "advertise-client-urls") {
return errUnsetAdvertiseClientURLsFlag
}
}
if 5*cfg.TickMs > cfg.ElectionMs {
return fmt.Errorf("-election-timeout[%vms] should be at least as 5 times as -heartbeat-interval[%vms]", cfg.ElectionMs, cfg.TickMs)