1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Handle project first-run without existing flow file

This commit is contained in:
Nick O'Leary 2018-01-31 21:31:45 +00:00
parent bbb9a3c63b
commit b847e962aa
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -781,9 +781,14 @@ function createDefaultProject(user, project) {
files.push(baseCredentialFileName);
flowFilePath = fspath.join(projectPath,baseFlowFileName);
credsFilePath = fspath.join(projectPath,baseCredentialFileName);
log.trace("Migrating "+project.files.oldFlow+" to "+flowFilePath);
if (fs.existsSync(project.files.oldFlow)) {
log.trace("Migrating "+project.files.oldFlow+" to "+flowFilePath);
promises.push(fs.copy(project.files.oldFlow,flowFilePath));
} else {
log.trace(project.files.oldFlow+" does not exist - creating blank file");
promises.push(util.writeFile(flowFilePath,"[]"));
}
log.trace("Migrating "+project.files.oldCredentials+" to "+credsFilePath);
promises.push(fs.copy(project.files.oldFlow,flowFilePath));
runtime.nodes.setCredentialSecret(project.credentialSecret);
promises.push(runtime.nodes.exportCredentials().then(function(creds) {
var credentialData;