Browse Source

embed: rename "Config.CorsInfo" to "Config.CORS"

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 7 years ago
parent
commit
c7cecca575
1 changed files with 7 additions and 7 deletions
  1. 7 7
      embed/config.go

+ 7 - 7
embed/config.go

@@ -169,7 +169,7 @@ type Config struct {
 	PeerTLSInfo   transport.TLSInfo
 	PeerAutoTLS   bool
 
-	CorsInfo map[string]struct{}
+	CORS map[string]struct{}
 
 	// HostWhitelist lists acceptable hostnames from HTTP client requests.
 	// Client origin policy protects against "DNS Rebinding" attacks
@@ -242,7 +242,7 @@ type configJSON struct {
 	APUrlsJSON string `json:"initial-advertise-peer-urls"`
 	ACUrlsJSON string `json:"advertise-client-urls"`
 
-	CorsJSON          string `json:"cors"`
+	CORSJSON          string `json:"cors"`
 	HostWhitelistJSON string `json:"host-whitelist"`
 
 	ClientSecurityJSON securityConfig `json:"client-transport-security"`
@@ -285,8 +285,8 @@ func NewConfig() *Config {
 		LogOutput:             DefaultLogOutput,
 		Metrics:               "basic",
 		EnableV2:              DefaultEnableV2,
-		CorsInfo:              make(map[string]struct{}),
-		HostWhitelist:         make(map[string]struct{}),
+		CORS:                  map[string]struct{}{"*": {}},
+		HostWhitelist:         map[string]struct{}{"*": {}},
 		AuthToken:             "simple",
 		PreVote:               false, // TODO: enable by default in v3.5
 	}
@@ -408,9 +408,9 @@ func (cfg *configYAML) configFromFile(path string) error {
 		cfg.ListenMetricsUrls = []url.URL(u)
 	}
 
-	if cfg.CorsJSON != "" {
-		uv := flags.NewUniqueURLsWithExceptions(cfg.HostWhitelistJSON, "*")
-		cfg.CorsInfo = uv.Values
+	if cfg.CORSJSON != "" {
+		uv := flags.NewUniqueURLsWithExceptions(cfg.CORSJSON, "*")
+		cfg.CORS = uv.Values
 	}
 
 	if cfg.HostWhitelistJSON != "" {