CredentialsFile management in v1.0

We are migrating fron Node-RED v0.19 to Node-RED 1.0
Is there a wiki describing some changes about credential management (if any) ?

In v 0.19, we used to override the credential file:

  • in settings.js we override defaultSettings.credentialsFile to handle a custom env var (a search/replace on flows_cred_<env>.json)
  • in package.json of a project we define the credentialsFile to data/flows_cred_<env>.json

It seems this credentialsFile variable is no longer loaded the same way ?
In the UI there is only flows_cred.json (our modification is not used).
Setting it in the UI do not change it after saving.

Is there somewhere in the code we can look to better understand what's happened ?
Thanks

EDIT: it seems the credential file MUST have the same name than the flow file + _cred.
Is there a workaround ? Our flow is versionned in GIT, always the same but credentials changes between dev/qual/prod

1 Like

Hi @JpEncausse

in settings.js we override defaultSettings.credentialsFile

I don't remember us having a setting called credentialsFile - I can't find anything in the 0.19 code base that would use a setting called that.

If you aren't using projects, then the code generates the credentials file name from the flow file name:

    credentialsFile = fspath.join(settings.userDir,ffBase+"_cred"+ffExt);

That is what it has always done.

If you are using projects, then it will use the credentials file you identify in the project's package.json file. I've just tested that in 1.0.2 and that part works as expected.

I have spotted a bug where the editor shows the credentials file name incorrectly - and if you edit the flow file name, it forces the credentials file to be the generated one. I will raise an issue to fix that. But if you don't edit the project file names via the editor, then it will use whatever values you have in your project's package.json.

Thanks Nick,
We'll do more test but it seems to behave like the bug you describe.

The issue I describe is only in the editor when you edit the file settings of the project. Is that what you are doing?

If not, then you'll have to share more details on what you are doing. As I said, we've never supported a setting called credentialsFile so I don't know where you have got that from.

I'm not clear if you are using the projects feature or not.