diff --git a/console/main.js b/console/main.js index f66d780..067a3d4 100644 --- a/console/main.js +++ b/console/main.js @@ -26,13 +26,15 @@ let midiInput = new midi.Input(); /** * Reads the config file and returns the JSON inside */ -async function readConfig(defaultConfig) { +async function readConfig(readConfig, defaultConfig) { // Check for existing config file if (!fs.existsSync(configPath)) { console.warn("No config.json file found, creating default at " + configPath); try { fs.writeFileSync(configPath, JSON.stringify(defaultConfig, null, 4)); - return defaultConfig; + + const configJson = fs.readFileSync(configPath, { encoding: 'utf8', flag: 'r' }); + return configJson; } catch (e) { console.error("Failed to write default config file " + configPath + "!");