1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-10 11:24:35 +00:00

Compare commits

...

1 Commits

Author SHA1 Message Date
Saad Jutt
d1a02c0da5 chore: debugging certs 2022-06-21 02:08:43 +05:00
2 changed files with 7 additions and 4 deletions

View File

@@ -16,9 +16,9 @@ appPromise.then(async (app) => {
)
})
} else {
const { key, cert } = await getCertificates()
const { key, cert, ca } = await getCertificates()
const httpsServer = createServer({ key, cert }, app)
const httpsServer = createServer({ key, cert, ca }, app)
httpsServer.listen(sasJsPort, () => {
console.log(
`⚡️[server]: Server is running at https://localhost:${sasJsPort}`

View File

@@ -2,18 +2,21 @@ import path from 'path'
import { fileExists, getString, readFile } from '@sasjs/utils'
export const getCertificates = async () => {
const { PRIVATE_KEY, FULL_CHAIN } = process.env
const { PRIVATE_KEY, FULL_CHAIN, CA } = process.env
const keyPath = PRIVATE_KEY ?? (await getFileInput('Private Key (PEM)'))
const certPath = FULL_CHAIN ?? (await getFileInput('Full Chain (PEM)'))
const caPath = CA ?? (await getFileInput('Full Chain (PEM)'))
console.log('keyPath: ', keyPath)
console.log('certPath: ', certPath)
console.log('caPath: ', caPath)
const key = await readFile(keyPath)
const cert = await readFile(certPath)
const ca = await readFile(caPath)
return { key, cert }
return { key, cert, ca }
}
const getFileInput = async (filename: string): Promise<string> => {