mirror of
https://github.com/sasjs/server.git
synced 2025-12-11 19:44:35 +00:00
fix: make CA_ROOT optional in getCertificates method
This commit is contained in:
@@ -4,17 +4,19 @@ import { fileExists, getString, readFile } from '@sasjs/utils'
|
|||||||
export const getCertificates = async () => {
|
export const getCertificates = async () => {
|
||||||
const { PRIVATE_KEY, CERT_CHAIN, CA_ROOT } = process.env
|
const { PRIVATE_KEY, CERT_CHAIN, CA_ROOT } = process.env
|
||||||
|
|
||||||
|
let ca
|
||||||
|
|
||||||
const keyPath = PRIVATE_KEY ?? (await getFileInput('Private Key (PEM)'))
|
const keyPath = PRIVATE_KEY ?? (await getFileInput('Private Key (PEM)'))
|
||||||
const certPath = CERT_CHAIN ?? (await getFileInput('Certificate Chain (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('keyPath: ', keyPath)
|
||||||
console.log('certPath: ', certPath)
|
console.log('certPath: ', certPath)
|
||||||
console.log('caPath: ', caPath)
|
if (caPath) console.log('caPath: ', caPath)
|
||||||
|
|
||||||
const key = await readFile(keyPath)
|
const key = await readFile(keyPath)
|
||||||
const cert = await readFile(certPath)
|
const cert = await readFile(certPath)
|
||||||
const ca = await readFile(caPath)
|
if (caPath) ca = await readFile(caPath)
|
||||||
|
|
||||||
return { key, cert, ca }
|
return { key, cert, ca }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user