From 585e381417fe3ce61f103f754648452a4ae2c752 Mon Sep 17 00:00:00 2001 From: velvettear Date: Tue, 29 Mar 2022 16:37:49 +0200 Subject: [PATCH] added config parameter 'dev' to trigger development mode --- example_config.json | 1 + libs/modep.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/example_config.json b/example_config.json index fae7721..539ee62 100644 --- a/example_config.json +++ b/example_config.json @@ -1,4 +1,5 @@ { + "dev": true, "server": { "listen": "0.0.0.0", "port": 3000 diff --git a/libs/modep.js b/libs/modep.js index 689447b..987ea2f 100644 --- a/libs/modep.js +++ b/libs/modep.js @@ -154,9 +154,10 @@ async function parseCurrentPedalboard(currentPedalboard) { if (currentPedalboard.uri === undefined) { throw new Error('could not determine current pedalboard config file'); } - // FAKE DATA - let file = path.resolve(path.dirname(__dirname) + '/dev/' + currentPedalboard.uri.substring(currentPedalboard.uri.lastIndexOf('/') + 1)); - // let file = path.resolve(currentPedalboard.uri.replace('file://', '')); + let file = path.resolve(currentPedalboard.uri.replace('file://', '')); + if (global.config?.dev) { + file = path.resolve(path.dirname(__dirname) + '/dev/' + currentPedalboard.uri.substring(currentPedalboard.uri.lastIndexOf('/') + 1)); + } const data = await new Promise((resolve, reject) => { fs.readFile(file, (err, data) => { if (err) {