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