ignore config and include an example config instead
This commit is contained in:
@@ -130,3 +130,5 @@ dist
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
# Tooloop
|
||||
config.json
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"url": "file:///assets/data/index.html",
|
||||
"allowedDomains": [
|
||||
"localhost",
|
||||
"127.0.0.1",
|
||||
"tooloop.de",
|
||||
"www.tooloop.de"
|
||||
],
|
||||
"logPath": "/assets/logs/Tooloop-Kiosk-Browser.log"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"url": "https://www.tooloop.de",
|
||||
"allowedDomains": [
|
||||
"tooloop.de",
|
||||
"www.tooloop.de"
|
||||
],
|
||||
"logPath": "/Users/vollstock/Arbeit/Playground/tooloop-kiosk-browser-logs/tooloop-kiosk-browser.log"
|
||||
}
|
||||
@@ -25,8 +25,12 @@ function loadConfig() {
|
||||
const data = fs.readFileSync(path.join(__dirname, "config.json"), { encoding: 'utf8' });
|
||||
config = JSON.parse(data);
|
||||
} catch (err) {
|
||||
if (err.code == 'ENOENT') {
|
||||
console.warn('No config file found.');
|
||||
} else {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,6 +63,7 @@ async function createWindow() {
|
||||
|
||||
win.loadFile('index.html');
|
||||
|
||||
if (config != undefined) {
|
||||
try {
|
||||
let url = new URL(config.url);
|
||||
// let options = {
|
||||
@@ -76,7 +81,7 @@ async function createWindow() {
|
||||
|
||||
} catch (err) {
|
||||
log.error(err);
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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