mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
*: do not whitelist empty hosts
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
02217cb6df
commit
9f0027dfb2
@ -176,7 +176,9 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) {
|
||||
|
||||
srvcfg.HostWhitelist = make(map[string]struct{}, len(cfg.HostWhitelist))
|
||||
for _, h := range cfg.HostWhitelist {
|
||||
srvcfg.HostWhitelist[h] = struct{}{}
|
||||
if h != "" {
|
||||
srvcfg.HostWhitelist[h] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
if e.Server, err = etcdserver.NewServer(srvcfg); err != nil {
|
||||
|
@ -277,9 +277,12 @@ func (cfg *config) configFromCmdLine() error {
|
||||
cfg.ec.ListenMetricsUrls = []url.URL(u)
|
||||
}
|
||||
|
||||
hosts := strings.Split(cfg.cf.hostWhitelist, ",")
|
||||
for i := range hosts {
|
||||
hosts[i] = strings.TrimSpace(hosts[i])
|
||||
hosts := []string{}
|
||||
for _, h := range strings.Split(cfg.cf.hostWhitelist, ",") {
|
||||
h = strings.TrimSpace(h)
|
||||
if h != "" {
|
||||
hosts = append(hosts, h)
|
||||
}
|
||||
}
|
||||
cfg.ec.HostWhitelist = hosts
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user