mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: #9957, don't remove existing fields form config.json
This commit is contained in:
@@ -527,7 +527,16 @@ install.save = async function (server_conf) {
|
|||||||
serverConfigPath = path.resolve(__dirname, '../', nconf.get('config'));
|
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');
|
console.log('Configuration Saved OK');
|
||||||
nconf.file({
|
nconf.file({
|
||||||
file: serverConfigPath,
|
file: serverConfigPath,
|
||||||
|
|||||||
Reference in New Issue
Block a user