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

Add NO_PROXY to shell env

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala 2020-09-29 14:10:36 +03:00
parent e1e3a4695a
commit 147f43c6a0
2 changed files with 8 additions and 2 deletions

View File

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

View File

@ -125,6 +125,8 @@ export class ShellSession extends EventEmitter {
if (this.preferences.httpsProxy) {
env["HTTPS_PROXY"] = this.preferences.httpsProxy
}
const no_proxy = ["localhost", "127.0.0.1", env["NO_PROXY"]]
env["NO_PROXY"] = no_proxy.filter(address => !!address).join()
if (env.DEBUG) { // do not pass debug option to bash
delete env["DEBUG"]
}