ignore config and include an example config instead
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user