mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Do not remove old config.json file to ease downgrade path
This commit is contained in:
parent
96d81ef72b
commit
e12975cf0b
@ -29,8 +29,24 @@ var globalSettingsBackup;
|
|||||||
var settings;
|
var settings;
|
||||||
|
|
||||||
async function migrateToMultipleConfigFiles() {
|
async function migrateToMultipleConfigFiles() {
|
||||||
|
const nodesFilename = getSettingsFilename("nodes");
|
||||||
|
if (fs.existsSync(nodesFilename)) {
|
||||||
|
// We have both .config.json and .config.nodes.json
|
||||||
|
// Use the more recently modified. This handles users going back to pre1.2
|
||||||
|
// and up again.
|
||||||
|
// We can remove this logic in 1.3+ and remove the old .config.json file entirely
|
||||||
|
//
|
||||||
|
const fsStatNodes = await fs.stat(nodesFilename);
|
||||||
|
const fsStatGlobal = await fs.stat(globalSettingsFile);
|
||||||
|
if (fsStatNodes.mtimeMs > fsStatGlobal.mtimeMs) {
|
||||||
|
// .config.nodes.json is newer than .config.json - no migration needed
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
const data = await util.readFile(globalSettingsFile,globalSettingsBackup,{});
|
const data = await util.readFile(globalSettingsFile,globalSettingsBackup,{});
|
||||||
return writeSettings(data).then( () => fs.remove(globalSettingsFile) );
|
// In a later release we should remove the old settings file. But don't do
|
||||||
|
// that *yet* otherwise users won't be able to downgrade easily.
|
||||||
|
return writeSettings(data) // .then( () => fs.remove(globalSettingsFile) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user