Location of stored credentials

Any fields marked as credentials get stored in a separate file from the flows file - usually flows_cred.json. Currently if you choose a different flow file name the the creds also get a similar name - eg myflow.json and myflow_cred.json - BUT... you can also specify a different directory for the flows file - and it works just fine... but the creds always stay in the user directory (typically ~/.node-red).

I must admit I had not noticed or indeed cared about this until yesterday... when using docker (yeah yeah I know) I wanted to mount "just" the flows and creds outside the container - but leave settings, nodes and other stuff from the userdir inside... and of course it turns out to be somewhat impossible due to the way we save the files on deploy... ie we write them with a temporary name first then rename them to help avoid file corruption - but this breaks using any symbolic links etc.

So should the creds "track" the location/directory of the flows file so at least they stay together ? That would be a breaking change - but a) would not affect most people who never moved their flow files... (or don't use creds :slight_smile: ) b) could be mitigated by checking for file existence etc so existing flows could work but new installs use the new locations.

Or should it be an optional flag to say where the creds are stored ?... uuurgh yet another option to have to think about.

Or is it just a "me" problem and just accept that I need to mount the complete userdir or nothing :frowning:

Thoughts please

1 Like

For me everything should be in the same folder.

But it should be thought about in the long term; if NR supports multi-user in depth, where should these files be stored? Will the flow be split per user? Yeah I know I went crazy.

I concur and believe that the cred file should always be in the same location as the flows file, as they are joined at the hip in a 1:1 relationship.
Having said that, to avoid breaking existing apps, and/or to enable saving the cred file in a special secure location, seems like the best way would be to control this in the settings.js file

1 Like

Personally, I agree that the flow and cred file should stay together. But also agree that you should be able to easily move them to a different location using protected settings.

Thanks all,

yes - so for a start I have proposed this PR. This uses existing location if the file already exists, but if not then creates any new file alongside the flows instead.

1 Like