mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Fixup tls config for tests
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user