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

Allow a project to be loaded from cmdline even if its unknown

This commit is contained in:
Nick O'Leary 2018-11-14 12:51:23 +00:00
parent 4f0aa1bc02
commit 20a31a6d38
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -126,6 +126,10 @@ function init(_settings, _runtime) {
} else {
activeProject = globalSettings.projects.activeProject;
}
if (!globalSettings.projects.projects) {
globalSettings.projects.projects = {};
saveSettings = true;
}
if (settings.flowFile) {
// if flowFile is a known project name - use it
if (globalSettings.projects.projects.hasOwnProperty(settings.flowFile)) {
@ -133,14 +137,19 @@ function init(_settings, _runtime) {
globalSettings.projects.activeProject = settings.flowFile;
saveSettings = true;
} else {
// if it resolves to a dir - use it... but:
// - where to get credsecret from?
// - what if the name clashes with a known project?
// var stat = fs.statSync(settings.flowFile);
// if (stat && stat.isDirectory()) {
// activeProject = settings.flowFile;
// }
// if it resolves to a dir - use it
var stat = fs.statSync(fspath.join(projectsDir,settings.flowFile));
if (stat && stat.isDirectory()) {
activeProject = settings.flowFile;
globalSettings.projects.activeProject = activeProject;
// Now check for a credentialSecret
if (settings.credentialSecret !== undefined) {
globalSettings.projects.projects[settings.flowFile] = {
credentialSecret: settings.credentialSecret
}
saveSettings = true;
}
}
}
}
if (!activeProject) {