Browse code

Merge pull request #34821 from thaJeztah/remove-enable-api-cors

Remove deprecated --enable-api-cors flag

Yong Tang authored on 2017/09/14 12:10:27
Showing 4 changed files
... ...
@@ -23,7 +23,6 @@ const versionMatcher = "/v{version:[0-9.]+}"
23 23
 // Config provides the configuration for the API server
24 24
 type Config struct {
25 25
 	Logging     bool
26
-	EnableCors  bool
27 26
 	CorsHeaders string
28 27
 	Version     string
29 28
 	SocketGroup string
... ...
@@ -33,8 +33,6 @@ func installConfigFlags(conf *config.Config, flags *pflag.FlagSet) {
33 33
 	flags.StringVar(&conf.BridgeConfig.FixedCIDRv6, "fixed-cidr-v6", "", "IPv6 subnet for fixed IPs")
34 34
 	flags.BoolVar(&conf.BridgeConfig.EnableUserlandProxy, "userland-proxy", true, "Use userland proxy for loopback traffic")
35 35
 	flags.StringVar(&conf.BridgeConfig.UserlandProxyPath, "userland-proxy-path", "", "Path to the userland proxy binary")
36
-	flags.BoolVar(&conf.EnableCors, "api-enable-cors", false, "Enable CORS headers in the Engine API, this is deprecated by --api-cors-header")
37
-	flags.MarkDeprecated("api-enable-cors", "Please use --api-cors-header")
38 36
 	flags.StringVar(&conf.CgroupParent, "cgroup-parent", "", "Set parent cgroup for all containers")
39 37
 	flags.StringVar(&conf.RemappedRoot, "userns-remap", "", "User/Group setting for user namespaces")
40 38
 	flags.StringVar(&conf.ContainerdAddr, "containerd", "", "Path to containerd socket")
... ...
@@ -132,7 +132,6 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
132 132
 		Logging:     true,
133 133
 		SocketGroup: cli.Config.SocketGroup,
134 134
 		Version:     dockerversion.Version,
135
-		EnableCors:  cli.Config.EnableCors,
136 135
 		CorsHeaders: cli.Config.CorsHeaders,
137 136
 	}
138 137
 
... ...
@@ -548,7 +547,7 @@ func (cli *DaemonCli) initMiddlewares(s *apiserver.Server, cfg *apiserver.Config
548 548
 	vm := middleware.NewVersionMiddleware(v, api.DefaultVersion, api.MinVersion)
549 549
 	s.UseMiddleware(vm)
550 550
 
551
-	if cfg.EnableCors || cfg.CorsHeaders != "" {
551
+	if cfg.CorsHeaders != "" {
552 552
 		c := middleware.NewCORSMiddleware(cfg.CorsHeaders)
553 553
 		s.UseMiddleware(c)
554 554
 	}
... ...
@@ -103,7 +103,6 @@ type CommonConfig struct {
103 103
 	Root                 string                    `json:"data-root,omitempty"`
104 104
 	SocketGroup          string                    `json:"group,omitempty"`
105 105
 	CorsHeaders          string                    `json:"api-cors-header,omitempty"`
106
-	EnableCors           bool                      `json:"api-enable-cors,omitempty"`
107 106
 
108 107
 	// TrustKeyPath is used to generate the daemon ID and for signing schema 1 manifests
109 108
 	// when pushing to a registry which does not support schema 2. This field is marked as