mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
embed: clean up CORS, HostWhitelist logging
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
@@ -180,7 +180,23 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) {
|
|||||||
if e.Server, err = etcdserver.NewServer(srvcfg); err != nil {
|
if e.Server, err = etcdserver.NewServer(srvcfg); err != nil {
|
||||||
return e, err
|
return e, err
|
||||||
}
|
}
|
||||||
plog.Infof("%s starting with host whitelist %q", e.Server.ID(), cfg.HostWhitelist)
|
|
||||||
|
if len(e.cfg.CORS) > 0 {
|
||||||
|
ss := make([]string, 0, len(e.cfg.CORS))
|
||||||
|
for v := range e.cfg.CORS {
|
||||||
|
ss = append(ss, v)
|
||||||
|
}
|
||||||
|
sort.Strings(ss)
|
||||||
|
plog.Infof("%s starting with cors %q", e.Server.ID(), ss)
|
||||||
|
}
|
||||||
|
if len(e.cfg.HostWhitelist) > 0 {
|
||||||
|
ss := make([]string, 0, len(e.cfg.HostWhitelist))
|
||||||
|
for v := range e.cfg.HostWhitelist {
|
||||||
|
ss = append(ss, v)
|
||||||
|
}
|
||||||
|
sort.Strings(ss)
|
||||||
|
plog.Infof("%s starting with host whitelist %q", e.Server.ID(), ss)
|
||||||
|
}
|
||||||
|
|
||||||
// buffer channel so goroutines on closed connections won't wait forever
|
// buffer channel so goroutines on closed connections won't wait forever
|
||||||
e.errc = make(chan error, len(e.Peers)+len(e.Clients)+2*len(e.sctxs))
|
e.errc = make(chan error, len(e.Peers)+len(e.Clients)+2*len(e.sctxs))
|
||||||
@@ -474,15 +490,6 @@ func (e *Etcd) serveClients() (err error) {
|
|||||||
plog.Infof("ClientTLS: %s", e.cfg.ClientTLSInfo)
|
plog.Infof("ClientTLS: %s", e.cfg.ClientTLSInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(e.cfg.CORS) > 0 {
|
|
||||||
ss := make([]string, 0, len(e.cfg.CORS))
|
|
||||||
for v := range e.cfg.CORS {
|
|
||||||
ss = append(ss, v)
|
|
||||||
}
|
|
||||||
sort.Strings(ss)
|
|
||||||
plog.Infof("cors = %q", ss)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start a client server goroutine for each listen address
|
// Start a client server goroutine for each listen address
|
||||||
var h http.Handler
|
var h http.Handler
|
||||||
if e.Config().EnableV2 {
|
if e.Config().EnableV2 {
|
||||||
|
|||||||
Reference in New Issue
Block a user