Skip to content

Commit

Permalink
that closure was terrible, use strings.replace directly
Browse files Browse the repository at this point in the history
  • Loading branch information
rteeling-evernorth committed Sep 27, 2024
1 parent 6cf775c commit 3dd55a3
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions environment/container/docker/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,14 @@ func (d dockerRuntime) createDaemonFile(conf map[string]any, env map[string]stri
if err != nil {
return err
}
translateProxy := func(proxyUrl string) string {
return strings.Replace(proxyUrl, "127.0.0.1", hostGatewayIP, -1)
}
if vars.http != "" {
proxyConf["http-proxy"] = translateProxy(vars.http)
proxyConf["http-proxy"] = strings.Replace(vars.http, "127.0.0.1", hostGatewayIP, -1)
}
if vars.https != "" {
proxyConf["https-proxy"] = translateProxy(vars.https)
proxyConf["https-proxy"] = strings.Replace(vars.https, "127.0.0.1", hostGatewayIP, -1)
}
if vars.no != "" {
proxyConf["no-proxy"] = translateProxy(vars.no)
proxyConf["no-proxy"] = strings.Replace(vars.no, "127.0.0.1", hostGatewayIP, -1)
}
conf["proxies"] = proxyConf
}
Expand Down

0 comments on commit 3dd55a3

Please sign in to comment.