mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdmain: update "CORS", "HostWhitelist" flag parsing
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
@@ -291,9 +291,8 @@ func (cfg *config) configFromCmdLine() error {
|
||||
cfg.ec.ACUrls = flags.UniqueURLsFromFlag(cfg.cf.flagSet, "advertise-client-urls")
|
||||
cfg.ec.ListenMetricsUrls = flags.UniqueURLsFromFlag(cfg.cf.flagSet, "listen-metrics-urls")
|
||||
|
||||
cv := flags.UniqueURLsMapFromFlag(cfg.cf.flagSet, "cors")
|
||||
cfg.ec.CorsInfo = &cv
|
||||
cfg.ec.HostWhitelist = flags.UniqueStringsFromFlag(cfg.cf.flagSet, "host-whitelist")
|
||||
cfg.ec.CORS = flags.UniqueURLsMapFromFlag(cfg.cf.flagSet, "cors")
|
||||
cfg.ec.HostWhitelist = flags.UniqueStringsMapFromFlag(cfg.cf.flagSet, "host-whitelist")
|
||||
|
||||
cfg.ec.ClusterState = cfg.cf.clusterState.String()
|
||||
cfg.cp.Fallback = cfg.cf.fallback.String()
|
||||
|
||||
@@ -30,7 +30,6 @@ import (
|
||||
"github.com/coreos/etcd/embed"
|
||||
"github.com/coreos/etcd/etcdserver"
|
||||
"github.com/coreos/etcd/etcdserver/api/etcdhttp"
|
||||
"github.com/coreos/etcd/pkg/cors"
|
||||
"github.com/coreos/etcd/pkg/fileutil"
|
||||
pkgioutil "github.com/coreos/etcd/pkg/ioutil"
|
||||
"github.com/coreos/etcd/pkg/osutil"
|
||||
@@ -301,10 +300,7 @@ func startProxy(cfg *config) error {
|
||||
return clientURLs
|
||||
}
|
||||
ph := httpproxy.NewHandler(pt, uf, time.Duration(cfg.cp.ProxyFailureWaitMs)*time.Millisecond, time.Duration(cfg.cp.ProxyRefreshIntervalMs)*time.Millisecond)
|
||||
ph = &cors.CORSHandler{
|
||||
Handler: ph,
|
||||
Info: cfg.ec.CorsInfo,
|
||||
}
|
||||
ph = embed.WrapCORS(cfg.ec.CORS, ph)
|
||||
|
||||
if cfg.isReadonlyProxy() {
|
||||
ph = httpproxy.NewReadonlyHandler(ph)
|
||||
|
||||
Reference in New Issue
Block a user