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

Ability to add projects path to the settings file (#2816)

* add the ability to set the projects path

* Update packages/node_modules/@node-red/runtime/locales/en-US/runtime.json

use directory to keep consistency with the project

Co-authored-by: Nick O'Leary <nick.oleary@gmail.com>

* Update packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/index.js

only show the projects directory is projects are enabled

Co-authored-by: Nick O'Leary <nick.oleary@gmail.com>

* use "directory" instead of "folder" to keep consistency with the Node-RED project

Co-authored-by: Nick O'Leary <nick.oleary@gmail.com>
This commit is contained in:
Tiago Ferreira 2021-01-18 13:18:07 +00:00 committed by GitHub
parent d8c8d7bc57
commit 55ff035fc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -1048,6 +1048,11 @@ function init(_settings, _runtime) {
settings = _settings;
runtime = _runtime;
projectsDir = fspath.join(settings.userDir,"projects");
if(settings.editorTheme.projects.path) {
projectsDir = settings.editorTheme.projects.path;
}
authCache.init();
}

View File

@ -114,6 +114,11 @@ function init(_settings, _runtime) {
Projects.init(settings,runtime);
sshTools.init(settings);
projectsDir = fspath.join(settings.userDir,"projects");
if(settings.editorTheme.projects.path) {
projectsDir = settings.editorTheme.projects.path;
}
if (!settings.readOnly) {
return fs.ensureDir(projectsDir)
//TODO: this is accessing settings from storage directly as settings
@ -501,6 +506,11 @@ async function getFlows() {
if (!initialFlowLoadComplete) {
initialFlowLoadComplete = true;
log.info(log._("storage.localfilesystem.user-dir",{path:settings.userDir}));
if (projectsEnabled) {
log.info(log._("storage.localfilesystem.projects.projects-directory", {projectsDirectory: projectsDir}));
}
if (activeProject) {
// At this point activeProject will be a string, so go load it and
// swap in an instance of Project

View File

@ -156,6 +156,7 @@
"projects": {
"changing-project": "Setting active project : __project__",
"active-project": "Active project : __project__",
"projects-directory": "Projects directory: __projectsDirectory__",
"project-not-found": "Project not found : __project__",
"no-active-project": "No active project : using default flows file",
"disabled": "Projects disabled : editorTheme.projects.enabled=false",