feat: #9957, don't remove existing fields form config.json

isekai-main
Barış Soner Uşaklı 3 years ago
parent 047f031dd7
commit 0532c1b2a1

@ -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,

Loading…
Cancel
Save