mirror of
https://github.com/sasjs/server.git
synced 2025-12-11 03:34:35 +00:00
chore: debugging certs
This commit is contained in:
@@ -16,9 +16,9 @@ appPromise.then(async (app) => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
} else {
|
} 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, () => {
|
httpsServer.listen(sasJsPort, () => {
|
||||||
console.log(
|
console.log(
|
||||||
`⚡️[server]: Server is running at https://localhost:${sasJsPort}`
|
`⚡️[server]: Server is running at https://localhost:${sasJsPort}`
|
||||||
|
|||||||
@@ -2,18 +2,21 @@ import path from 'path'
|
|||||||
import { fileExists, getString, readFile } from '@sasjs/utils'
|
import { fileExists, getString, readFile } from '@sasjs/utils'
|
||||||
|
|
||||||
export const getCertificates = async () => {
|
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 keyPath = PRIVATE_KEY ?? (await getFileInput('Private Key (PEM)'))
|
||||||
const certPath = FULL_CHAIN ?? (await getFileInput('Full Chain (PEM)'))
|
const certPath = FULL_CHAIN ?? (await getFileInput('Full Chain (PEM)'))
|
||||||
|
const caPath = CA ?? (await getFileInput('Full Chain (PEM)'))
|
||||||
|
|
||||||
console.log('keyPath: ', keyPath)
|
console.log('keyPath: ', keyPath)
|
||||||
console.log('certPath: ', certPath)
|
console.log('certPath: ', certPath)
|
||||||
|
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)
|
||||||
|
|
||||||
return { key, cert }
|
return { key, cert, ca }
|
||||||
}
|
}
|
||||||
|
|
||||||
const getFileInput = async (filename: string): Promise<string> => {
|
const getFileInput = async (filename: string): Promise<string> => {
|
||||||
|
|||||||
Reference in New Issue
Block a user