Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let settings = {};
try {
let data = await fs.readFile(globalSettingsFile,'utf8')
settings = util.parseJSON(data);
} catch(err) {
log.trace("Corrupted global config detected - resetting");
}
let nodesSettings = {};
try {
data = await fs.readFile(projectSettingsFile, 'utf8');
nodesSettings = util.parseJSON(data);
} catch(err) {
log.trace("Corrupted project config detected - resetting");
}
Object.assign(settings, nodesSettings);
return resolve(settings);
})
},
return when.promise(async function(resolve,reject) {
let settings = {};
try {
let data = await fs.readFile(globalSettingsFile,'utf8')
settings = util.parseJSON(data);
} catch(err) {
log.trace("Corrupted global config detected - resetting");
}
let nodesSettings = {};
try {
data = await fs.readFile(projectSettingsFile, 'utf8');
nodesSettings = util.parseJSON(data);
} catch(err) {
log.trace("Corrupted project config detected - resetting");
}
Object.assign(settings, nodesSettings);
return resolve(settings);
})
fs.readFile(sessionsFile,'utf8',function(err,data){
if (!err) {
try {
return resolve(util.parseJSON(data));
} catch(err2) {
log.trace("Corrupted sessions file - resetting");
}
}
resolve({});
})
});