mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix startup due to buildVersion dependency
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
8cf435d2fb
commit
d2d546342e
@ -7,14 +7,14 @@ import { clearKubeconfigEnvVars } from "../utils/clear-kube-env-vars";
|
|||||||
|
|
||||||
describe("clearKubeconfigEnvVars tests", () => {
|
describe("clearKubeconfigEnvVars tests", () => {
|
||||||
it("should not touch non kubeconfig keys", () => {
|
it("should not touch non kubeconfig keys", () => {
|
||||||
expect(clearKubeconfigEnvVars({ a: 1 })).toStrictEqual({ a: 1 });
|
expect(clearKubeconfigEnvVars({ a: "22" })).toStrictEqual({ a: "22" });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should remove a single kubeconfig key", () => {
|
it("should remove a single kubeconfig key", () => {
|
||||||
expect(clearKubeconfigEnvVars({ a: 1, kubeconfig: "1" })).toStrictEqual({ a: 1 });
|
expect(clearKubeconfigEnvVars({ a: "22", kubeconfig: "1" })).toStrictEqual({ a: "22" });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should remove a two kubeconfig key", () => {
|
it("should remove a two kubeconfig key", () => {
|
||||||
expect(clearKubeconfigEnvVars({ a: 1, kubeconfig: "1", kUbeconfig: "1" })).toStrictEqual({ a: 1 });
|
expect(clearKubeconfigEnvVars({ a: "22", kubeconfig: "1", kUbeconfig: "1" })).toStrictEqual({ a: "22" });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -44,7 +44,7 @@ const openLocalShellSessionInjectable = getInjectable({
|
|||||||
userStore: di.inject(userStoreInjectable),
|
userStore: di.inject(userStoreInjectable),
|
||||||
resolvedShell: di.inject(resolvedShellInjectable),
|
resolvedShell: di.inject(resolvedShellInjectable),
|
||||||
appName: di.inject(appNameInjectable),
|
appName: di.inject(appNameInjectable),
|
||||||
buildVersion: di.inject(buildVersionInjectable).get(),
|
buildVersion: di.inject(buildVersionInjectable),
|
||||||
modifyTerminalShellEnv: di.inject(modifyTerminalShellEnvInjectable),
|
modifyTerminalShellEnv: di.inject(modifyTerminalShellEnvInjectable),
|
||||||
getDirnameOfPath: di.inject(getDirnameOfPathInjectable),
|
getDirnameOfPath: di.inject(getDirnameOfPathInjectable),
|
||||||
joinPaths: di.inject(joinPathsInjectable),
|
joinPaths: di.inject(joinPathsInjectable),
|
||||||
|
|||||||
@ -35,7 +35,7 @@ const openNodeShellSessionInjectable = getInjectable({
|
|||||||
logger: di.inject(loggerInjectable),
|
logger: di.inject(loggerInjectable),
|
||||||
resolvedShell: di.inject(resolvedShellInjectable),
|
resolvedShell: di.inject(resolvedShellInjectable),
|
||||||
appName: di.inject(appNameInjectable),
|
appName: di.inject(appNameInjectable),
|
||||||
buildVersion: di.inject(buildVersionInjectable).get(),
|
buildVersion: di.inject(buildVersionInjectable),
|
||||||
createKubeJsonApiForCluster: di.inject(createKubeJsonApiForClusterInjectable),
|
createKubeJsonApiForCluster: di.inject(createKubeJsonApiForClusterInjectable),
|
||||||
computeShellEnvironment: di.inject(computeShellEnvironmentInjectable),
|
computeShellEnvironment: di.inject(computeShellEnvironmentInjectable),
|
||||||
spawnPty: di.inject(spawnPtyInjectable),
|
spawnPty: di.inject(spawnPtyInjectable),
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import { type TerminalMessage, TerminalChannels } from "../../common/terminal/ch
|
|||||||
import type { Logger } from "../../common/logger";
|
import type { Logger } from "../../common/logger";
|
||||||
import type { ComputeShellEnvironment } from "../utils/shell-env/compute-shell-environment.injectable";
|
import type { ComputeShellEnvironment } from "../utils/shell-env/compute-shell-environment.injectable";
|
||||||
import type { SpawnPty } from "./spawn-pty.injectable";
|
import type { SpawnPty } from "./spawn-pty.injectable";
|
||||||
|
import type { InitializableState } from "../../common/initializable-state/create";
|
||||||
|
|
||||||
export class ShellOpenError extends Error {
|
export class ShellOpenError extends Error {
|
||||||
constructor(message: string, options?: ErrorOptions) {
|
constructor(message: string, options?: ErrorOptions) {
|
||||||
@ -108,7 +109,7 @@ export interface ShellSessionDependencies {
|
|||||||
readonly logger: Logger;
|
readonly logger: Logger;
|
||||||
readonly resolvedShell: string | undefined;
|
readonly resolvedShell: string | undefined;
|
||||||
readonly appName: string;
|
readonly appName: string;
|
||||||
readonly buildVersion: string;
|
readonly buildVersion: InitializableState<string>;
|
||||||
computeShellEnvironment: ComputeShellEnvironment;
|
computeShellEnvironment: ComputeShellEnvironment;
|
||||||
spawnPty: SpawnPty;
|
spawnPty: SpawnPty;
|
||||||
}
|
}
|
||||||
@ -376,7 +377,7 @@ export abstract class ShellSession {
|
|||||||
env.PTYPID = process.pid.toString();
|
env.PTYPID = process.pid.toString();
|
||||||
env.KUBECONFIG = await this.kubeconfigPathP;
|
env.KUBECONFIG = await this.kubeconfigPathP;
|
||||||
env.TERM_PROGRAM = this.dependencies.appName;
|
env.TERM_PROGRAM = this.dependencies.appName;
|
||||||
env.TERM_PROGRAM_VERSION = this.dependencies.buildVersion;
|
env.TERM_PROGRAM_VERSION = this.dependencies.buildVersion.get();
|
||||||
|
|
||||||
if (this.cluster.preferences.httpsProxy) {
|
if (this.cluster.preferences.httpsProxy) {
|
||||||
env.HTTPS_PROXY = this.cluster.preferences.httpsProxy;
|
env.HTTPS_PROXY = this.cluster.preferences.httpsProxy;
|
||||||
|
|||||||
@ -13,7 +13,7 @@ const anyKubeconfig = /^kubeconfig$/i;
|
|||||||
* before KUBECONFIG and we only set KUBECONFIG.
|
* before KUBECONFIG and we only set KUBECONFIG.
|
||||||
* @param env The current copy of env
|
* @param env The current copy of env
|
||||||
*/
|
*/
|
||||||
export function clearKubeconfigEnvVars(env: Record<string, any>): Record<string, any> {
|
export function clearKubeconfigEnvVars(env: Partial<Record<string, string>>): Partial<Record<string, string>> {
|
||||||
return Object.fromEntries(
|
return Object.fromEntries(
|
||||||
Object.entries(env)
|
Object.entries(env)
|
||||||
.filter(([key]) => anyKubeconfig.exec(key) === null),
|
.filter(([key]) => anyKubeconfig.exec(key) === null),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user