Tweak the credential handling

- use node.credentials rather than node._creds for consistency with the runtime
 - simplify the structure of node.credentials
This commit is contained in:
Nick O'Leary
2014-07-19 00:16:21 +01:00
parent 760dd022dc
commit b604db83f6
4 changed files with 91 additions and 76 deletions

View File

@@ -183,8 +183,15 @@ RED.nodes = function() {
for (var d in n._def.defaults) {
node[d] = n[d];
}
if(exportCreds && n._creds) {
node._creds = n._creds.send;
if(exportCreds && n.credentials) {
node.credentials = {};
for (var cred in n._def.credentials) {
if (n._def.credentials.hasOwnProperty(cred)) {
if (n.credentials[cred] != null) {
node.credentials[cred] = n.credentials[cred];
}
}
}
}
if (n._def.category != "config") {
node.x = n.x;