diff --git a/src/install.js b/src/install.js index 98339c1314..7016662d05 100644 --- a/src/install.js +++ b/src/install.js @@ -527,7 +527,16 @@ install.save = async function (server_conf) { serverConfigPath = path.resolve(__dirname, '../', nconf.get('config')); } - await fs.promises.writeFile(serverConfigPath, JSON.stringify(server_conf, null, 4)); + let currentConfig = {}; + try { + currentConfig = require(serverConfigPath); + } catch (err) { + if (err.code !== 'MODULE_NOT_FOUND') { + throw err; + } + } + + await fs.promises.writeFile(serverConfigPath, JSON.stringify({ ...currentConfig, ...server_conf }, null, 4)); console.log('Configuration Saved OK'); nconf.file({ file: serverConfigPath,