settings WIP

This commit is contained in:
Jan Prochazka
2022-02-26 13:08:01 +01:00
parent 2b61c8a21f
commit 9267ca326f
12 changed files with 191 additions and 58 deletions

View File

@@ -30,14 +30,14 @@ 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 = {};
}
// 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.
@@ -199,7 +199,10 @@ function createWindow() {
mainMenu = buildMenu();
mainWindow.setMenu(mainMenu);
function loadMainWindow() {
async function loadMainWindow() {
const settings = await main.configController.getSettings();
console.log(settings);
const startUrl =
process.env.ELECTRON_START_URL ||
url.format({