File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -1012,19 +1012,23 @@ function getSparkplugConfig (connection) {
10121012
10131013 let secOpts = { }
10141014 if ( connection . useSecurity ) {
1015- certOpts = { }
1016- if ( connection . pfxFilePath !== '' ) {
1015+ let certOpts = { }
1016+ if ( ( connection . pfxFilePath !== '' ) && Fs . existsSync ( connection . pfxFilePath ) ) {
10171017 certOpts = {
10181018 pfx : Fs . readFileSync ( connection . pfxFilePath ) ,
10191019 passphrase : connection . passphrase
10201020 }
10211021 } else {
1022- certOpts = {
1023- ca : Fs . readFileSync ( connection . rootCertFilePath ) ,
1024- key : Fs . readFileSync ( connection . privateKeyFilePath ) ,
1025- cert : Fs . readFileSync ( connection . localCertFilePath ) ,
1026- passphrase : connection . passphrase
1022+ if ( ( connection . rootCertFilePath !== '' ) && Fs . existsSync ( connection . rootCertFilePath ) ) {
1023+ certOpts . ca = Fs . readFileSync ( connection . rootCertFilePath )
1024+ }
1025+ if ( ( connection . privateKeyFilePath !== '' ) && Fs . existsSync ( connection . privateKeyFilePath ) ) {
1026+ certOpts . key = Fs . readFileSync ( connection . privateKeyFilePath )
1027+ }
1028+ if ( ( connection . localCertFilePath !== '' ) && Fs . existsSync ( connection . localCertFilePath ) ) {
1029+ certOpts . cert = Fs . readFileSync ( connection . localCertFilePath )
10271030 }
1031+ certOpts . passphrase = connection . passphrase
10281032 }
10291033
10301034 secOpts = {
You can’t perform that action at this time.
0 commit comments