1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Mangle NO_PROXY harder

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala 2020-09-30 13:09:04 +03:00
parent 0b5ed4b8f6
commit 9513a6b582

View File

@ -284,11 +284,11 @@ export class Kubectl {
bashScript += `export PATH="${helmPath}:${kubectlPath}:$PATH"\n` bashScript += `export PATH="${helmPath}:${kubectlPath}:$PATH"\n`
bashScript += "export KUBECONFIG=\"$tempkubeconfig\"\n" bashScript += "export KUBECONFIG=\"$tempkubeconfig\"\n"
bashScript += "if [ -z \"$NO_PROXY\" ]; then\n" bashScript += "NO_PROXY=\",${NO_PROXY:-localhost},\"\n"
bashScript += " export NO_PROXY=\"localhost,127.0.0.1\"\n" bashScript += "NO_PROXY=\"${NO_PROXY//,localhost,/,}\"\n"
bashScript += "elif [ \"$NO_PROXY\" != \"localhost,127.0.0.1\" ]; then\n" bashScript += "NO_PROXY=\"${NO_PROXY//,127.0.0.1,/,}\"\n"
bashScript += " export NO_PROXY=\"localhost,127.0.0.1,$NO_PROXY\"\n" bashScript += "NO_PROXY=\"localhost,127.0.0.1${NO_PROXY%,}\"\n"
bashScript += "fi\n" bashScript += "export NO_PROXY\n"
bashScript += "unset tempkubeconfig\n" bashScript += "unset tempkubeconfig\n"
await fsPromises.writeFile(bashScriptPath, bashScript.toString(), { mode: 0o644 }) await fsPromises.writeFile(bashScriptPath, bashScript.toString(), { mode: 0o644 })
@ -314,11 +314,11 @@ export class Kubectl {
zshScript += "d=${d/#:/}\n" zshScript += "d=${d/#:/}\n"
zshScript += "export PATH=\"$helmpath:$kubectlpath:${d/%:/}\"\n" zshScript += "export PATH=\"$helmpath:$kubectlpath:${d/%:/}\"\n"
zshScript += "export KUBECONFIG=\"$tempkubeconfig\"\n" zshScript += "export KUBECONFIG=\"$tempkubeconfig\"\n"
zshScript += "if test -z \"$NO_PROXY\"; then\n" zshScript += "NO_PROXY=\",${NO_PROXY:-localhost},\"\n"
zshScript += " export NO_PROXY=\"localhost,127.0.0.1\"\n" zshScript += "NO_PROXY=\"${NO_PROXY//,localhost,/,}\"\n"
zshScript += "elif [ \"$NO_PROXY\" != \"localhost,127.0.0.1\" ]; then\n" zshScript += "NO_PROXY=\"${NO_PROXY//,127.0.0.1,/,}\"\n"
zshScript += " export NO_PROXY=\"localhost,127.0.0.1,$NO_PROXY\"\n" zshScript += "NO_PROXY=\"localhost,127.0.0.1${NO_PROXY%,}\"\n"
zshScript += "fi\n" zshScript += "export NO_PROXY\n"
zshScript += "unset tempkubeconfig\n" zshScript += "unset tempkubeconfig\n"
zshScript += "unset OLD_ZDOTDIR\n" zshScript += "unset OLD_ZDOTDIR\n"
await fsPromises.writeFile(zshScriptPath, zshScript.toString(), { mode: 0o644 }) await fsPromises.writeFile(zshScriptPath, zshScript.toString(), { mode: 0o644 })