diff --git a/daemon/config/config.go b/daemon/config/config.go index ab8380e15c..5d2544fce8 100644 --- a/daemon/config/config.go +++ b/daemon/config/config.go @@ -160,7 +160,9 @@ type CommonConfig struct { ExecRoot string `json:"exec-root,omitempty"` SocketGroup string `json:"group,omitempty"` CorsHeaders string `json:"api-cors-header,omitempty"` - ProxyConfig + + // Proxies holds the proxies that are configured for the daemon. + Proxies `json:"proxies"` // TrustKeyPath is used to generate the daemon ID and for signing schema 1 manifests // when pushing to a registry which does not support schema 2. This field is marked as @@ -271,8 +273,8 @@ type CommonConfig struct { DefaultRuntime string `json:"default-runtime,omitempty"` } -// ProxyConfig holds the proxy-configuration for the daemon. -type ProxyConfig struct { +// Proxies holds the proxies that are configured for the daemon. +type Proxies struct { HTTPProxy string `json:"http-proxy,omitempty"` HTTPSProxy string `json:"https-proxy,omitempty"` NoProxy string `json:"no-proxy,omitempty"` diff --git a/daemon/reload.go b/daemon/reload.go index 55454bab5b..edfd623f8d 100644 --- a/daemon/reload.go +++ b/daemon/reload.go @@ -30,10 +30,10 @@ func (daemon *Daemon) Reload(conf *config.Config) (err error) { if err == nil { jsonString, _ := json.Marshal(&struct { *config.Config - config.ProxyConfig + config.Proxies `json:"proxies"` }{ Config: daemon.configStore, - ProxyConfig: config.ProxyConfig{ + Proxies: config.Proxies{ HTTPProxy: config.MaskCredentials(daemon.configStore.HTTPProxy), HTTPSProxy: config.MaskCredentials(daemon.configStore.HTTPSProxy), NoProxy: config.MaskCredentials(daemon.configStore.NoProxy), diff --git a/integration/daemon/daemon_test.go b/integration/daemon/daemon_test.go index 0c4f80f959..346857d9ae 100644 --- a/integration/daemon/daemon_test.go +++ b/integration/daemon/daemon_test.go @@ -253,7 +253,7 @@ func TestDaemonProxy(t *testing.T) { ctx := context.Background() configFile := filepath.Join(d.RootDir(), "daemon.json") - configJSON := fmt.Sprintf(`{"http-proxy":%[1]q, "https-proxy": %[1]q, "no-proxy": "example.com"}`, proxyServer.URL) + configJSON := fmt.Sprintf(`{"proxies":{"http-proxy":%[1]q, "https-proxy": %[1]q, "no-proxy": "example.com"}}`, proxyServer.URL) assert.NilError(t, os.WriteFile(configFile, []byte(configJSON), 0644)) d.Start(t, "--config-file", configFile) @@ -293,7 +293,7 @@ func TestDaemonProxy(t *testing.T) { d := daemon.New(t) configFile := filepath.Join(d.RootDir(), "daemon.json") - configJSON := fmt.Sprintf(`{"http-proxy":%[1]q, "https-proxy": %[1]q, "no-proxy": "example.com"}`, proxyRawURL) + configJSON := fmt.Sprintf(`{"proxies":{"http-proxy":%[1]q, "https-proxy": %[1]q, "no-proxy": "example.com"}}`, proxyRawURL) assert.NilError(t, os.WriteFile(configFile, []byte(configJSON), 0644)) err := d.StartWithError("--http-proxy", proxyRawURL, "--https-proxy", proxyRawURL, "--no-proxy", "example.com", "--config-file", configFile, "--validate")