From 0e0c1cfad3799e7fd9fc37a481941d21e2aaab5e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 28 Feb 2019 00:17:33 +0000 Subject: [PATCH] Add support for localConfig at $appData/config.json. Move electron-config to $appData/electron-config.json Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- electron_app/src/electron-main.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index a86e818b92..99ddfbd186 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -56,7 +56,15 @@ try { // Continue with the defaults (ie. an empty config) } -const store = new Store(); +try { + // Load local config and use it to override values from the one baked with the build + const localConfig = require(path.join(app.getPath('userData'), 'config.json')); + vectorConfig = Object.assign(vectorConfig, localConfig); +} catch (e) { + // Could not load local config, this is expected in most cases. +} + +const store = new Store({ name: "electron-config" }); let mainWindow = null; global.appQuitting = false;