2021-06-12 07:11:06 +08:00
|
|
|
import * as fs from "fs";
|
2017-04-13 01:57:55 +08:00
|
|
|
|
2021-06-12 07:11:06 +08:00
|
|
|
function getFile(path) {
|
2017-04-13 01:57:55 +08:00
|
|
|
if (fs.existsSync(path)) {
|
|
|
|
return path
|
|
|
|
}
|
|
|
|
return undefined
|
|
|
|
}
|
|
|
|
|
2021-06-12 07:11:06 +08:00
|
|
|
const defaultSSLConfig = {
|
2018-03-26 20:15:25 +02:00
|
|
|
sslKeyPath: getFile('/run/secrets/key.pem'),
|
|
|
|
sslCertPath: getFile('/run/secrets/cert.pem'),
|
|
|
|
sslCAPath: getFile('/run/secrets/ca.pem') !== undefined ? [getFile('/run/secrets/ca.pem')] : [],
|
|
|
|
dhParamPath: getFile('/run/secrets/dhparam.pem')
|
2017-04-13 01:57:55 +08:00
|
|
|
}
|
2021-06-12 07:11:06 +08:00
|
|
|
|
|
|
|
export = defaultSSLConfig
|