mirror of
https://github.com/containers/podman.git
synced 2025-11-03 07:47:19 +08:00
Use HTTPProxy settings from containers.conf
This PR takes the settings from containers.conf and uses them. This works on the podman local but does not fix the issue for podman remote or for APIv2. We need a way to specify optionalbooleans when creating containers. Fixes: https://github.com/containers/podman/issues/8843 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
13
vendor/github.com/containers/common/pkg/config/config.go
generated
vendored
13
vendor/github.com/containers/common/pkg/config/config.go
generated
vendored
@ -746,13 +746,20 @@ func (c *Config) FindConmon() (string, error) {
|
||||
}
|
||||
|
||||
// GetDefaultEnv returns the environment variables for the container.
|
||||
// It will checn the HTTPProxy and HostEnv booleans and add the appropriate
|
||||
// It will check the HTTPProxy and HostEnv booleans and add the appropriate
|
||||
// environment variables to the container.
|
||||
func (c *Config) GetDefaultEnv() []string {
|
||||
return c.GetDefaultEnvEx(c.Containers.EnvHost, c.Containers.HTTPProxy)
|
||||
}
|
||||
|
||||
// GetDefaultEnvEx returns the environment variables for the container.
|
||||
// It will check the HTTPProxy and HostEnv boolean parameters and return the appropriate
|
||||
// environment variables for the container.
|
||||
func (c *Config) GetDefaultEnvEx(envHost, httpProxy bool) []string {
|
||||
var env []string
|
||||
if c.Containers.EnvHost {
|
||||
if envHost {
|
||||
env = append(env, os.Environ()...)
|
||||
} else if c.Containers.HTTPProxy {
|
||||
} else if httpProxy {
|
||||
proxy := []string{"http_proxy", "https_proxy", "ftp_proxy", "no_proxy", "HTTP_PROXY", "HTTPS_PROXY", "FTP_PROXY", "NO_PROXY"}
|
||||
for _, p := range proxy {
|
||||
if val, ok := os.LookupEnv(p); ok {
|
||||
|
||||
Reference in New Issue
Block a user