summaryrefslogtreecommitdiff
path: root/pkg/spec
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-05-01 14:51:55 +0200
committerGitHub <noreply@github.com>2019-05-01 14:51:55 +0200
commiteea77b5ae3e7fb8a60d438a79d3a4b30d35bb67c (patch)
tree37f8f7740e9e615a561422410ff91a0ce13bead0 /pkg/spec
parent39c937ee450a4de7ab97c013d65157a3b39718b1 (diff)
parent354d80626ac4790f261a29a6d53d6cd3fa837bb9 (diff)
downloadpodman-eea77b5ae3e7fb8a60d438a79d3a4b30d35bb67c.tar.gz
podman-eea77b5ae3e7fb8a60d438a79d3a4b30d35bb67c.tar.bz2
podman-eea77b5ae3e7fb8a60d438a79d3a4b30d35bb67c.zip
Merge pull request #3018 from jamescassell/auto-http-proxy
Auto http proxy
Diffstat (limited to 'pkg/spec')
-rw-r--r--pkg/spec/createconfig.go1
-rw-r--r--pkg/spec/spec.go18
2 files changed, 19 insertions, 0 deletions
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go
index 064dedd45..9c674d9f1 100644
--- a/pkg/spec/createconfig.go
+++ b/pkg/spec/createconfig.go
@@ -87,6 +87,7 @@ type CreateConfig struct {
NoHosts bool
HostAdd []string //add-host
Hostname string //hostname
+ HTTPProxy bool
Image string
ImageID string
BuiltinImgVolumes map[string]struct{} // volumes defined in the image config
diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go
index 4cbed0ea4..383eeadf3 100644
--- a/pkg/spec/spec.go
+++ b/pkg/spec/spec.go
@@ -192,6 +192,24 @@ func CreateConfigToOCISpec(config *CreateConfig) (*spec.Spec, error) { //nolint
}
g.SetRootReadonly(config.ReadOnlyRootfs)
+ if config.HTTPProxy {
+ for _, envSpec := range []string{
+ "http_proxy",
+ "HTTP_PROXY",
+ "https_proxy",
+ "HTTPS_PROXY",
+ "ftp_proxy",
+ "FTP_PROXY",
+ "no_proxy",
+ "NO_PROXY",
+ } {
+ envVal := os.Getenv(envSpec)
+ if envVal != "" {
+ g.AddProcessEnv(envSpec, envVal)
+ }
+ }
+ }
+
hostname := config.Hostname
if hostname == "" && (config.NetMode.IsHost() || config.UtsMode.IsHost()) {
hostname, err = os.Hostname()