From fd4f7477060e62c79cafe45dfbe4f004d1e5aeca Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 11 Nov 2024 16:26:20 +0000 Subject: [PATCH 1/2] If creds dont exist - create in flows dir rather than userdir So they stay alongside flows --- .../runtime/lib/storage/localfilesystem/projects/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/index.js b/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/index.js index ca87d76e9..8d6cea26a 100644 --- a/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/index.js +++ b/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/index.js @@ -85,7 +85,10 @@ function init(_settings, _runtime) { var ffBase = fspath.basename(flowsFullPath,ffExt); flowsFileBackup = getBackupFilename(flowsFullPath); - credentialsFile = fspath.join(settings.userDir,ffBase+"_cred"+ffExt); + credentialsFile = fspath.join(settings.userDir,ffBase+"_cred"+ffExt); // if creds file exists in "old" location use + if (!fs.existsSync(credentialsFile)) { // if not then locate it next to flows file in user dir + credentialsFile = fspath.join(fspath.dirname(flowsFullPath), ffBase+"_cred"+ffExt); + } credentialsFileBackup = getBackupFilename(credentialsFile) var setupProjectsPromise; From 8aa65e77619bb31128b3fd6cc6f6d6a7e36d69e6 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 11 Nov 2024 16:28:42 +0000 Subject: [PATCH 2/2] fix comments to be what is happening. --- .../runtime/lib/storage/localfilesystem/projects/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/index.js b/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/index.js index 8d6cea26a..b19889bcb 100644 --- a/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/index.js +++ b/packages/node_modules/@node-red/runtime/lib/storage/localfilesystem/projects/index.js @@ -85,8 +85,8 @@ function init(_settings, _runtime) { var ffBase = fspath.basename(flowsFullPath,ffExt); flowsFileBackup = getBackupFilename(flowsFullPath); - credentialsFile = fspath.join(settings.userDir,ffBase+"_cred"+ffExt); // if creds file exists in "old" location use - if (!fs.existsSync(credentialsFile)) { // if not then locate it next to flows file in user dir + credentialsFile = fspath.join(settings.userDir,ffBase+"_cred"+ffExt); // if creds file exists in "old" location userdir then use it + if (!fs.existsSync(credentialsFile)) { // if not then locate it next to flows file in flows dir credentialsFile = fspath.join(fspath.dirname(flowsFullPath), ffBase+"_cred"+ffExt); } credentialsFileBackup = getBackupFilename(credentialsFile)