mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Cache settings when doing initial load
This commit is contained in:
parent
bb4330e486
commit
e6ffa3d143
@ -88,11 +88,13 @@ async function readSettings() {
|
|||||||
// Read the 'runtime' settings file first
|
// Read the 'runtime' settings file first
|
||||||
const runtimeFilename = getSettingsFilename("runtime");
|
const runtimeFilename = getSettingsFilename("runtime");
|
||||||
const result = await util.readFile(runtimeFilename,runtimeFilename+".backup",{});
|
const result = await util.readFile(runtimeFilename,runtimeFilename+".backup",{});
|
||||||
|
settingsCache["runtime"] = JSON.stringify(result, null ,4);
|
||||||
const readPromises = [];
|
const readPromises = [];
|
||||||
// Read the other settings files and add them into the runtime settings
|
// Read the other settings files and add them into the runtime settings
|
||||||
configSections.forEach(key => {
|
configSections.forEach(key => {
|
||||||
const sectionFilename = getSettingsFilename(key);
|
const sectionFilename = getSettingsFilename(key);
|
||||||
readPromises.push(util.readFile(sectionFilename,sectionFilename+".backup",{}).then(sectionData => {
|
readPromises.push(util.readFile(sectionFilename,sectionFilename+".backup",{}).then(sectionData => {
|
||||||
|
settingsCache[key] = JSON.stringify(sectionData, null ,4);
|
||||||
if (Object.keys(sectionData).length > 0) {
|
if (Object.keys(sectionData).length > 0) {
|
||||||
result[key] = sectionData;
|
result[key] = sectionData;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user