Merge pull request #43448 from thaJeztah/daemon_config_group_proxies
daemon/config: move proxy settings to "proxies" struct within daemon.json
This commit is contained in:
commit
63a9e3cc93
3 changed files with 9 additions and 7 deletions
|
@ -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"`
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue