From 74ebda03b2cf854925c4d9f833f38e45441ecf9b Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Tue, 12 Oct 2021 12:33:01 -0400 Subject: [PATCH] Check existence of cert before providing to readfile() --- src/routes.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/routes.js b/src/routes.js index 3c51b747..260ede51 100644 --- a/src/routes.js +++ b/src/routes.js @@ -52,10 +52,14 @@ module.exports = async ( ) => { try { const Http = Axios.create({ - httpsAgent: new httpsAgent.Agent({ - ca: await FS.readFile(CA), - key: await FS.readFile(CA_KEY) - }) + httpsAgent: new httpsAgent.Agent( + CA && CA_KEY + ? { + ca: await FS.readFile(CA), + key: await FS.readFile(CA_KEY) + } + : {} + ) }) const sanitizeLNDError = (message = '') => {