load settings.json in electron app

This commit is contained in:
Jan Prochazka
2022-02-24 18:31:33 +01:00
parent e23b5b4124
commit 3d5e441994
2 changed files with 11 additions and 2 deletions

View File

@@ -30,6 +30,15 @@ try {
initialConfig = {};
}
let settingsJson = {};
try {
const datadir = path.join(os.homedir(), 'dbgate-data');
settingsJson = JSON.parse(fs.readFileSync(path.join(datadir, 'settings.json'), { encoding: 'utf-8' }));
} catch (err) {
console.log('Error loading settings.json:', err.message);
settingsJson = {};
}
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;