Fixup tls config for tests

Add-pfxp12-to-tls-options
Dave Conway-Jones 2024-10-09 17:46:07 +01:00
parent 214fbc0e47
commit 71440be009
No known key found for this signature in database
GPG Key ID: 1DDB0E91A28C2643
3 changed files with 13 additions and 6 deletions

View File

@ -22,15 +22,16 @@ module.exports = function(RED) {
RED.nodes.createNode(this,n);
this.valid = true;
this.verifyservercert = n.verifyservercert;
var certPath = n.cert.trim();
var keyPath = n.key.trim();
var caPath = n.ca.trim();
var p12Path = n.p12.trim();
var certPath, keyPath, caPath, p12Path;
if (n.cert) { certPath = n.cert.trim(); }
if (n.key) { keyPath = n.key.trim(); }
if (n.ca) { caPath = n.ca.trim(); }
if (n.p12) { p12Path = n.p12.trim(); }
this.certType = n.certType || "files";
this.servername = (n.servername||"").trim();
this.alpnprotocol = (n.alpnprotocol||"").trim();
if ((certPath.length > 0) || (keyPath.length > 0) || (caPath.length > 0)) {
if ((certPath && certPath.length > 0) || (keyPath && keyPath.length > 0) || (caPath && caPath.length > 0)) {
if ( (certPath.length > 0) !== (keyPath.length > 0)) {
this.valid = false;
@ -55,7 +56,7 @@ module.exports = function(RED) {
return;
}
}
else if (p12Path.length > 0) {
else if (p12Path && p12Path.length > 0) {
try {
this.pfx = fs.readFileSync(p12Path);
}

View File

@ -0,0 +1,2 @@
File message line 1
File message line 2

View File

@ -0,0 +1,4 @@
{
"instanceId": "bff8dba3f474d406",
"_credentialSecret": "c9ca84d93a4f6236426cc740b147b50f32b3dd9aab9f4191390a604197722a4d"
}