Skip to content

Commit

Permalink
pkg: use PROXY_VARS from c/common
Browse files Browse the repository at this point in the history
Signed-off-by: Aditya Rajan <[email protected]>
  • Loading branch information
flouthoc committed Jan 10, 2022
1 parent a8b02cf commit a95c01e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
4 changes: 2 additions & 2 deletions pkg/machine/ignition.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"path/filepath"

"github.com/containers/common/pkg/config"
"github.com/sirupsen/logrus"
)

Expand Down Expand Up @@ -479,8 +480,7 @@ func getCerts(certsDir string, isDir bool) []File {

func getProxyVariables() string {
proxyOpts := ""
proxyVariables := []string{"HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY", "http_proxy", "https_proxy", "no_proxy"}
for _, variable := range proxyVariables {
for _, variable := range config.ProxyEnv {
if value, ok := os.LookupEnv(variable); ok {
proxyOpts += fmt.Sprintf("\n export %s=%s", variable, value)
}
Expand Down
12 changes: 2 additions & 10 deletions pkg/specgen/generate/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

"github.com/containers/common/libimage"
"github.com/containers/common/pkg/config"
"github.com/containers/podman/v3/libpod"
"github.com/containers/podman/v3/libpod/define"
ann "github.com/containers/podman/v3/pkg/annotations"
Expand Down Expand Up @@ -126,16 +127,7 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat
if s.EnvHost {
defaultEnvs = envLib.Join(defaultEnvs, osEnv)
} else if s.HTTPProxy {
for _, envSpec := range []string{
"http_proxy",
"HTTP_PROXY",
"https_proxy",
"HTTPS_PROXY",
"ftp_proxy",
"FTP_PROXY",
"no_proxy",
"NO_PROXY",
} {
for _, envSpec := range config.ProxyEnv {
if v, ok := osEnv[envSpec]; ok {
defaultEnvs[envSpec] = v
}
Expand Down

0 comments on commit a95c01e

Please sign in to comment.