ignore config and include an example config instead

This commit is contained in:
2024-05-28 18:50:15 +02:00
parent 6a53286f67
commit 6102f3d4f6
4 changed files with 35 additions and 26 deletions
+23 -18
View File
@@ -25,7 +25,11 @@ function loadConfig() {
const data = fs.readFileSync(path.join(__dirname, "config.json"), { encoding: 'utf8' });
config = JSON.parse(data);
} catch (err) {
console.error(err);
if (err.code == 'ENOENT') {
console.warn('No config file found.');
} else {
console.error(err);
}
}
}
@@ -59,24 +63,25 @@ async function createWindow() {
win.loadFile('index.html');
try {
let url = new URL(config.url);
// let options = {
// method: 'HEAD',
// host: url.hostname,
// port: url.port ? url.port : 80,
// path: '/'
// };
// let req = http.request(options, function (r) {
// log.info(r.headers);
// });
// req.end();
if (config != undefined) {
try {
let url = new URL(config.url);
// let options = {
// method: 'HEAD',
// host: url.hostname,
// port: url.port ? url.port : 80,
// path: '/'
// };
// let req = http.request(options, function (r) {
// log.info(r.headers);
// });
// req.end();
win.loadURL(config.url);
win.loadURL(config.url);
} catch (err) {
log.error(err);
} finally {
} catch (err) {
log.error(err);
}
}
}
@@ -103,7 +108,7 @@ app.whenReady().then(() => {
loadConfig();
log.initialize();
if ('logPath' in config) {
if (config != undefined && 'logPath' in config) {
log.transports.file.resolvePathFn = () => config.logPath;
}