mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Don't even attempt to run migrations on renderer
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
1d19501064
commit
a484e8f2aa
@ -46,6 +46,10 @@ export abstract class BaseStore<T> extends Singleton {
|
|||||||
protected constructor(protected params: BaseStoreParams<T>) {
|
protected constructor(protected params: BaseStoreParams<T>) {
|
||||||
super();
|
super();
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
|
|
||||||
|
if (ipcRenderer) {
|
||||||
|
params.migrations = undefined; // don't run migrations on renderer
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { app } from "electron";
|
import { app, ipcMain } from "electron";
|
||||||
import semver from "semver";
|
import semver from "semver";
|
||||||
import { action, computed, observable, reaction, makeObservable } from "mobx";
|
import { action, computed, observable, reaction, makeObservable } from "mobx";
|
||||||
import { BaseStore } from "../base-store";
|
import { BaseStore } from "../base-store";
|
||||||
@ -48,7 +48,11 @@ export class UserStore extends BaseStore<UserStoreModel> /* implements UserStore
|
|||||||
});
|
});
|
||||||
|
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
fileNameMigration();
|
|
||||||
|
if (ipcMain) {
|
||||||
|
fileNameMigration();
|
||||||
|
}
|
||||||
|
|
||||||
this.load();
|
this.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,21 +19,22 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { app } from "electron";
|
||||||
import { existsSync, readFileSync } from "fs";
|
import { existsSync, readFileSync } from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import os from "os";
|
import os from "os";
|
||||||
import type { ClusterStoreModel } from "../../common/cluster-store";
|
import type { ClusterStoreModel } from "../../common/cluster-store";
|
||||||
import type { KubeconfigSyncEntry, UserPreferencesModel } from "../../common/user-store";
|
import type { KubeconfigSyncEntry, UserPreferencesModel } from "../../common/user-store";
|
||||||
import { MigrationDeclaration, migrationLog } from "../helpers";
|
import { MigrationDeclaration, migrationLog } from "../helpers";
|
||||||
import { getPath, isLogicalChildPath, storedKubeConfigFolder } from "../../common/utils";
|
import { isLogicalChildPath, storedKubeConfigFolder } from "../../common/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
version: "5.0.3-beta.1",
|
version: "5.0.3-beta.1",
|
||||||
run(store) {
|
run(store) {
|
||||||
try {
|
try {
|
||||||
const { syncKubeconfigEntries = [], ...preferences }: UserPreferencesModel = store.get("preferences") ?? {};
|
const { syncKubeconfigEntries = [], ...preferences }: UserPreferencesModel = store.get("preferences") ?? {};
|
||||||
const { clusters = [] }: ClusterStoreModel = JSON.parse(readFileSync(path.resolve(getPath("userData"), "lens-cluster-store.json"), "utf-8")) ?? {};
|
const { clusters = [] }: ClusterStoreModel = JSON.parse(readFileSync(path.resolve(app.getPath("userData"), "lens-cluster-store.json"), "utf-8")) ?? {};
|
||||||
const extensionDataDir = path.resolve(getPath("userData"), "extension_data");
|
const extensionDataDir = path.resolve(app.getPath("userData"), "extension_data");
|
||||||
const syncPaths = new Set(syncKubeconfigEntries.map(s => s.filePath));
|
const syncPaths = new Set(syncKubeconfigEntries.map(s => s.filePath));
|
||||||
|
|
||||||
syncPaths.add(path.join(os.homedir(), ".kube"));
|
syncPaths.add(path.join(os.homedir(), ".kube"));
|
||||||
|
|||||||
@ -19,12 +19,12 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { app } from "electron";
|
||||||
import fse from "fs-extra";
|
import fse from "fs-extra";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { getPath } from "../../common/utils/getPath";
|
|
||||||
|
|
||||||
export function fileNameMigration() {
|
export function fileNameMigration() {
|
||||||
const userDataPath = getPath("userData");
|
const userDataPath = app.getPath("userData");
|
||||||
const configJsonPath = path.join(userDataPath, "config.json");
|
const configJsonPath = path.join(userDataPath, "config.json");
|
||||||
const lensUserStoreJsonPath = path.join(userDataPath, "lens-user-store.json");
|
const lensUserStoreJsonPath = path.join(userDataPath, "lens-user-store.json");
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user