# CredentialsFile management in v1.0

**URL:** <https://discourse.nodered.org/t/credentialsfile-management-in-v1-0/17001>\
**Category:** Core Development\
**Created:** [22 October 2019 08:48 UTC](https://discourse.nodered.org/t/credentialsfile-management-in-v1-0/17001 "2019-10-22T08:48:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JpEncausse](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jpencausse/32/2561_2.png) [@JpEncausse](https://discourse.nodered.org/u/JpEncausse)\
**Post date:** [22 October 2019 08:48 UTC](https://discourse.nodered.org/t/credentialsfile-management-in-v1-0/17001/1 "2019-10-22T08:48:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [22 October 2019 09:14 UTC](https://discourse.nodered.org/t/credentialsfile-management-in-v1-0/17001/2 "2019-10-22T09:14:59Z")

</div>

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](https://github.com/node-red/node-red/blob/0.19.6/red/runtime/storage/localfilesystem/projects/index.js#L85-L86):

```auto
    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.

---

<div class="post-metadata">

**Author:** ![JpEncausse](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jpencausse/32/2561_2.png) [@JpEncausse](https://discourse.nodered.org/u/JpEncausse)\
**Post date:** [23 October 2019 17:43 UTC](https://discourse.nodered.org/t/credentialsfile-management-in-v1-0/17001/3 "2019-10-23T17:43:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [23 October 2019 18:14 UTC](https://discourse.nodered.org/t/credentialsfile-management-in-v1-0/17001/4 "2019-10-23T18:14:36Z")

</div>

> [@JpEncausse](#):
>
> 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.
