I finally figured out how to send a config flag to the node instance of a plugin.
const {
AWS_ACCESS_KEY_ID,
AWS_REGION,
AMAZON_REGION,
AWS_SECRET_ACCESS_KEY
} = process.env;
module.exports = function(RED) {
function AWSConfigNode(config) {
const node = this;
RED.nodes.createNode(node, config);
node.accessKey = node.credentials.accessKey || AWS_ACCESS_KEY_ID;
node.secretKey = node.credentials.secretKey || AWS_SECRET_ACCESS_KEY;
node.region = config.region || AWS_REGION || AMAZON_REGION;
node.name = config.name;
}
RED.nodes.registerType("aws-sdk-any-config", AWSConfigNode, {
settings: {
awsSdkAnyConfig_hasCredentials: {
value: !!(AWS_ACCESS_KEY_ID && AWS_SECRET_ACCESS_KEY),
exportable: true
}
},
credentials: {
accessKey: { type: "text" },
secretKey: { type: "password" }
}
});
};
However, I was expecting this flag to be available within the Custom Edit Events. In the screenshot the execution context (this
) has some good information, but not the awsSdkAnyConfig_hasCredentials
setting.
I did find the setting available with this call: RED.settings.awsSdkAnyConfig_hasCredentials
.
Would it be possible to add this as a new feature by passing these settings as an argument to the Custom Edit Functions?