Is there anyway to deploy flows to multiple devices and not have the credentials for applicable nodes not lose configuration?
I tried deploying the flows credential file when I deployed the matching flows file. But I still get the warning that the credentials file is invalid, which is understandable, if I understand the design as such, anchored to the original system instance, if not node red instance.
If there is not a way to do such, I would point out that cached (once validated) credentials are deployed remotely all the time, in various environments and for various solutions. If the given id does not exist on the remote machine, or the password is out sync, failure results, which is the correct behavior, so it would not be like you could somehow establish or create access from accepting deployment of cached credentials.
There really should be some option for this IMHO. How about the warning dialog as a passive warning, but the credentials still are honored, if some node red configuration setting is set to allow same? Maybe an override option in the settings.js file?
When you say you tried deploying the credential file, do you mean you did a POST of the file to the /flows endpoint?
The correct way to deploy flows & credentials is to send a POST to /flows in the format:
{
"flows": [ ... contents of your flows file ... ],
"credentials: { ... contents of your credentials file
}
And must set the Node-RED-API-Version HTTP header to v2.
If your credentials file is encrypted, then you must make sure all of the target devices have the same value of credentialSecret set in their settings file - otherwise they will not be able to decrypt the credentials.
The ability to pass in the credentials object to this API was added a while ago, but I see the API docs were not updated. I'll raise an issue to remind us to fix that.
You can also just copy the two files over to the devices and restart Node-RED if that's easier for you. The comment on ensuring each device has the same credentialSecret still stands.
That was the next idea! Cool. Right now I just have script file that does file copies out to each device, so this should be easy to do. I have also implemented a POST sequence in a flow, got that working as well. Long term want to use the POST method, using a 'admin' tab in the ui from one node red instance.
When the API docs are updated? Suggestion, include a complete example of how to do the POST, including how to qualify the API version setting. Not a POST guru, so I have no idea, at the moment how to qualify the API version. Can I append it to the flows verb?