added config parameter 'dev' to trigger development mode

This commit is contained in:
Daniel Sommer 2022-03-29 16:37:49 +02:00
parent a5c6801a4b
commit 585e381417
2 changed files with 5 additions and 3 deletions

View file

@ -1,4 +1,5 @@
{ {
"dev": true,
"server": { "server": {
"listen": "0.0.0.0", "listen": "0.0.0.0",
"port": 3000 "port": 3000

View file

@ -154,9 +154,10 @@ async function parseCurrentPedalboard(currentPedalboard) {
if (currentPedalboard.uri === undefined) { if (currentPedalboard.uri === undefined) {
throw new Error('could not determine current pedalboard config file'); throw new Error('could not determine current pedalboard config file');
} }
// FAKE DATA let file = path.resolve(currentPedalboard.uri.replace('file://', ''));
let file = path.resolve(path.dirname(__dirname) + '/dev/' + currentPedalboard.uri.substring(currentPedalboard.uri.lastIndexOf('/') + 1)); if (global.config?.dev) {
// let file = path.resolve(currentPedalboard.uri.replace('file://', '')); file = path.resolve(path.dirname(__dirname) + '/dev/' + currentPedalboard.uri.substring(currentPedalboard.uri.lastIndexOf('/') + 1));
}
const data = await new Promise((resolve, reject) => { const data = await new Promise((resolve, reject) => {
fs.readFile(file, (err, data) => { fs.readFile(file, (err, data) => {
if (err) { if (err) {