From 539a9c3a23de6b3920dca6c8aff0df13618db80a Mon Sep 17 00:00:00 2001 From: tycrek Date: Wed, 16 Jun 2021 14:44:13 -0600 Subject: [PATCH] `npm run setup` now references existing config for defaults --- setup.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.js b/setup.js index 636a7b3..a2c452c 100755 --- a/setup.js +++ b/setup.js @@ -1,5 +1,5 @@ // Default configuration -const config = { +var config = { host: '0.0.0.0', port: 40115, domain: 'upload.example.com', @@ -19,6 +19,11 @@ if (require.main === module) { const fs = require('fs-extra'); const prompt = require('prompt'); + try { + let existingConfig = require('./config.json'); + Object.keys(existingConfig).forEach((key) => config.hasOwnProperty(key) && (config[key] = existingConfig[key])) + } catch (ex) { console.log(ex) } + // Disabled the annoying "prompt: " prefix and removes colours prompt.message = ''; prompt.colors = false;