From 1b5859ee37ae73c419115b9debfd5141a79733de Mon Sep 17 00:00:00 2001 From: Sabir Hassan Date: Wed, 22 Jun 2022 00:25:41 +0500 Subject: [PATCH] fix: make CA_ROOT optional in getCertificates method --- api/src/utils/getCertificates.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/src/utils/getCertificates.ts b/api/src/utils/getCertificates.ts index 8b59a26..6c295e0 100644 --- a/api/src/utils/getCertificates.ts +++ b/api/src/utils/getCertificates.ts @@ -4,17 +4,19 @@ import { fileExists, getString, readFile } from '@sasjs/utils' export const getCertificates = async () => { const { PRIVATE_KEY, CERT_CHAIN, CA_ROOT } = process.env + let ca + const keyPath = PRIVATE_KEY ?? (await getFileInput('Private Key (PEM)')) const certPath = CERT_CHAIN ?? (await getFileInput('Certificate Chain (PEM)')) - const caPath = CA_ROOT ?? (await getFileInput('CA ROOT (PEM)')) + const caPath = CA_ROOT console.log('keyPath: ', keyPath) console.log('certPath: ', certPath) - console.log('caPath: ', caPath) + if (caPath) console.log('caPath: ', caPath) const key = await readFile(keyPath) const cert = await readFile(certPath) - const ca = await readFile(caPath) + if (caPath) ca = await readFile(caPath) return { key, cert, ca } }