1
0
mirror of https://github.com/rancher/os.git synced 2025-06-23 21:47:03 +00:00

Use double-quoted string for writing proxy.sh

Presence of special characters (i.e. &) in proxy environment values causes generation of an invalid /etc/profile.d/proxy.sh file.
This is a problem due to the common inclusion of special characters in passwords and proxy strings of the format htt[p|s]://user:pass@url:port.
This commit is contained in:
niusmallnan 2019-05-28 15:03:32 +08:00 committed by niusmallnan
parent 8d7f7199c9
commit 41b562c01f

View File

@ -182,7 +182,7 @@ func consoleInitFunc() error {
proxyLines := []string{}
for _, k := range []string{"http_proxy", "HTTP_PROXY", "https_proxy", "HTTPS_PROXY", "no_proxy", "NO_PROXY"} {
if v, ok := cfg.Rancher.Environment[k]; ok {
proxyLines = append(proxyLines, fmt.Sprintf("export %s=%s", k, v))
proxyLines = append(proxyLines, fmt.Sprintf("export %s=%q", k, v))
}
}