mirror of
https://github.com/Pandipipas/scoreko-electron-dev.git
synced 2026-06-06 05:32:06 +00:00
Make userData directory configurable via env (#36)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
export type AppRuntimeConfig = {
|
||||
title: string;
|
||||
userModelId: string;
|
||||
userDataDirectoryName: string;
|
||||
iconPathOverride?: string;
|
||||
nodecgPort: string;
|
||||
bundleName: string;
|
||||
@@ -19,6 +20,7 @@ export function getRuntimeConfig(): AppRuntimeConfig {
|
||||
return {
|
||||
title: getEnv("SCOREKO_APP_TITLE", "Scoreko"),
|
||||
userModelId: getEnv("SCOREKO_APP_USER_MODEL_ID", "com.scoreko.desktop"),
|
||||
userDataDirectoryName: getEnv("SCOREKO_APP_USER_DATA_DIRECTORY", "scoreko"),
|
||||
iconPathOverride: getOptionalEnv("SCOREKO_APP_ICON_PATH"),
|
||||
nodecgPort: parseEnvPort("NODECG_PORT", "9090"),
|
||||
bundleName: getEnv("NODECG_BUNDLE_NAME", "scoreko-dev"),
|
||||
|
||||
+4
-2
@@ -9,6 +9,10 @@ import { createLoadingWindow, createMainWindow } from "./windows/window-factory"
|
||||
|
||||
const appConfig = getRuntimeConfig();
|
||||
|
||||
// Force a stable userData folder name; overridable via SCOREKO_APP_USER_DATA_DIRECTORY.
|
||||
app.setName(appConfig.title);
|
||||
app.setPath("userData", path.join(app.getPath("appData"), appConfig.userDataDirectoryName));
|
||||
|
||||
const isDev = !app.isPackaged;
|
||||
const rootPath = isDev ? path.resolve(__dirname, "../..") : process.resourcesPath;
|
||||
const nodecgRootPath = path.resolve(rootPath, "lib", "nodecg");
|
||||
@@ -96,8 +100,6 @@ function stopNodecgGracefully(): Promise<void> {
|
||||
}
|
||||
|
||||
app.on("ready", () => {
|
||||
app.setName(appConfig.title);
|
||||
|
||||
if (process.platform === "win32") {
|
||||
app.setAppUserModelId(appConfig.userModelId);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ function getBaseConfig(): AppRuntimeConfig {
|
||||
return {
|
||||
title: "Scoreko",
|
||||
userModelId: "com.scoreko.desktop",
|
||||
userDataDirectoryName: "scoreko",
|
||||
nodecgPort: "9090",
|
||||
bundleName: "scoreko-dev",
|
||||
mainDashboardRoute: "dashboard/scoreko-dev/main.html?standalone=true",
|
||||
|
||||
@@ -21,6 +21,7 @@ function getBaseConfig(): AppRuntimeConfig {
|
||||
return {
|
||||
title: "Scoreko",
|
||||
userModelId: "com.scoreko.desktop",
|
||||
userDataDirectoryName: "scoreko",
|
||||
nodecgPort: "9090",
|
||||
bundleName: "scoreko-dev",
|
||||
mainDashboardRoute: "dashboard/scoreko-dev/main.html?standalone=true",
|
||||
|
||||
Reference in New Issue
Block a user