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

Respect HTTPS_PROXY for port-forwards

This commit is contained in:
Phillip LeBlanc 2023-09-01 19:39:23 +09:00
parent f1a960fd78
commit e26641688f
2 changed files with 9 additions and 1 deletions

View File

@ -21,6 +21,7 @@ export interface PortForwardArgs {
name: string;
port: number;
forwardPort: number;
httpsProxy?: string;
}
export interface PortForwardDependencies {
@ -49,6 +50,7 @@ export class PortForward {
public name: string;
public port: number;
public forwardPort: number;
public httpsProxy?: string;
constructor(private dependencies: PortForwardDependencies, public pathToKubeConfig: string, args: PortForwardArgs) {
this.clusterId = args.clusterId;
@ -57,6 +59,7 @@ export class PortForward {
this.name = args.name;
this.port = args.port;
this.forwardPort = args.forwardPort;
this.httpsProxy = args.httpsProxy;
}
public async start() {
@ -70,7 +73,10 @@ export class PortForward {
];
this.process = spawn(kubectlBin, args, {
env: process.env,
env: {
...process.env,
HTTPS_PROXY: this.httpsProxy,
},
});
PortForward.portForwards.push(this);
this.process.on("exit", () => {

View File

@ -35,6 +35,7 @@ const startPortForwardRouteInjectable = getRouteInjectable({
namespace,
port,
forwardPort,
httpsProxy: cluster.preferences.httpsProxy,
});
if (!portForward) {
@ -54,6 +55,7 @@ const startPortForwardRouteInjectable = getRouteInjectable({
name: resourceName,
port,
forwardPort: thePort,
httpsProxy: cluster.preferences.httpsProxy,
});
const started = await portForward.start();