mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
Merge pull request #18955 from BlackHole1/remove-hard-code
refactor(machine): remove hard code
This commit is contained in:
@ -12,6 +12,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/containers/common/libnetwork/etchosts"
|
||||||
"github.com/containers/common/pkg/config"
|
"github.com/containers/common/pkg/config"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
@ -618,9 +619,8 @@ func GetProxyVariables() map[string]string {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: use constants for host.containers.internal
|
v := strings.ReplaceAll(value, "127.0.0.1", etchosts.HostContainersInternal)
|
||||||
v := strings.ReplaceAll(value, "127.0.0.1", "host.containers.internal")
|
v = strings.ReplaceAll(v, "localhost", etchosts.HostContainersInternal)
|
||||||
v = strings.ReplaceAll(v, "localhost", "host.containers.internal")
|
|
||||||
proxyOpts[variable] = v
|
proxyOpts[variable] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/containers/common/libnetwork/etchosts"
|
||||||
"github.com/containers/podman/v4/pkg/machine"
|
"github.com/containers/podman/v4/pkg/machine"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
@ -55,11 +56,11 @@ func TestPropagateHostEnv(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"http_proxy": {
|
"http_proxy": {
|
||||||
"127.0.0.1:8888",
|
"127.0.0.1:8888",
|
||||||
"host.containers.internal:8888",
|
fmt.Sprintf("%s:8888", etchosts.HostContainersInternal),
|
||||||
},
|
},
|
||||||
"https_proxy": {
|
"https_proxy": {
|
||||||
"localhost:8888",
|
"localhost:8888",
|
||||||
"host.containers.internal:8888",
|
fmt.Sprintf("%s:8888", etchosts.HostContainersInternal),
|
||||||
},
|
},
|
||||||
"SSL_CERT_FILE": {
|
"SSL_CERT_FILE": {
|
||||||
"/some/f=oo.cert",
|
"/some/f=oo.cert",
|
||||||
|
Reference in New Issue
Block a user