mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Flatten user preferences in user store (#2587)
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
119d584bcb
commit
afa5379ba9
16 files changed
+212
-116
No files matched your search
+7
-7
@@ -113,12 +113,12 @@ export class Kubectl {
|
||||
}
|
||||
|
||||
public getPathFromPreferences() {
|
||||
return UserStore.getInstance().preferences?.kubectlBinariesPath || this.getBundledPath();
|
||||
return UserStore.getInstance().kubectlBinariesPath || this.getBundledPath();
|
||||
}
|
||||
|
||||
protected getDownloadDir() {
|
||||
if (UserStore.getInstance().preferences?.downloadBinariesPath) {
|
||||
return path.join(UserStore.getInstance().preferences.downloadBinariesPath, "kubectl");
|
||||
if (UserStore.getInstance().downloadBinariesPath) {
|
||||
return path.join(UserStore.getInstance().downloadBinariesPath, "kubectl");
|
||||
}
|
||||
|
||||
return Kubectl.kubectlDir;
|
||||
@@ -129,7 +129,7 @@ export class Kubectl {
|
||||
return this.getBundledPath();
|
||||
}
|
||||
|
||||
if (UserStore.getInstance().preferences?.downloadKubectlBinaries === false) {
|
||||
if (UserStore.getInstance().downloadKubectlBinaries === false) {
|
||||
return this.getPathFromPreferences();
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ export class Kubectl {
|
||||
}
|
||||
|
||||
public async ensureKubectl(): Promise<boolean> {
|
||||
if (UserStore.getInstance().preferences?.downloadKubectlBinaries === false) {
|
||||
if (UserStore.getInstance().downloadKubectlBinaries === false) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ export class Kubectl {
|
||||
}
|
||||
|
||||
protected async writeInitScripts() {
|
||||
const kubectlPath = UserStore.getInstance().preferences?.downloadKubectlBinaries ? this.dirname : path.dirname(this.getPathFromPreferences());
|
||||
const kubectlPath = UserStore.getInstance().downloadKubectlBinaries ? this.dirname : path.dirname(this.getPathFromPreferences());
|
||||
const helmPath = helmCli.getBinaryDir();
|
||||
const fsPromises = fs.promises;
|
||||
const bashScriptPath = path.join(this.dirname, ".bash_set_path");
|
||||
@@ -361,7 +361,7 @@ export class Kubectl {
|
||||
}
|
||||
|
||||
protected getDownloadMirror() {
|
||||
const mirror = packageMirrors.get(UserStore.getInstance().preferences?.downloadMirror);
|
||||
const mirror = packageMirrors.get(UserStore.getInstance().downloadMirror);
|
||||
|
||||
if (mirror) {
|
||||
return mirror;
|
||||
|
||||
@@ -21,8 +21,8 @@ export class LocalShellSession extends ShellSession {
|
||||
|
||||
protected async getShellArgs(shell: string): Promise<string[]> {
|
||||
const helmpath = helmCli.getBinaryDir();
|
||||
const pathFromPreferences = UserStore.getInstance().preferences.kubectlBinariesPath || this.kubectl.getBundledPath();
|
||||
const kubectlPathDir = UserStore.getInstance().preferences.downloadKubectlBinaries ? await this.kubectlBinDirP : path.dirname(pathFromPreferences);
|
||||
const pathFromPreferences = UserStore.getInstance().kubectlBinariesPath || this.kubectl.getBundledPath();
|
||||
const kubectlPathDir = UserStore.getInstance().downloadKubectlBinaries ? await this.kubectlBinDirP : path.dirname(pathFromPreferences);
|
||||
|
||||
switch(path.basename(shell)) {
|
||||
case "powershell.exe":
|
||||
|
||||
@@ -119,7 +119,7 @@ export abstract class ShellSession {
|
||||
protected async getShellEnv() {
|
||||
const env = clearKubeconfigEnvVars(JSON.parse(JSON.stringify(await shellEnv())));
|
||||
const pathStr = [...this.getPathEntries(), await this.kubectlBinDirP, process.env.PATH].join(path.delimiter);
|
||||
const shell = UserStore.getInstance().preferences.shell || process.env.SHELL || process.env.PTYSHELL;
|
||||
const shell = UserStore.getInstance().resolvedShell;
|
||||
|
||||
delete env.DEBUG; // don't pass DEBUG into shells
|
||||
|
||||
|
||||
Reference in new issue
Block a user