From c7cecca5755d4a587ecd1aed48f55f9056c371d6 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Mon, 26 Mar 2018 17:11:27 -0700 Subject: [PATCH] embed: rename "Config.CorsInfo" to "Config.CORS" Signed-off-by: Gyuho Lee --- embed/config.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/embed/config.go b/embed/config.go index 79a6736bb..6549d1f7e 100644 --- a/embed/config.go +++ b/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 != "" {