25 lines
766 B
JavaScript
25 lines
766 B
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.default = grabDbSSL;
|
|
const fs_1 = __importDefault(require("fs"));
|
|
/**
|
|
* # Grall SSL
|
|
*/
|
|
function grabDbSSL() {
|
|
const SSL_DIR = process.env.DSQL_SSL_DIR;
|
|
if (!(SSL_DIR === null || SSL_DIR === void 0 ? void 0 : SSL_DIR.match(/./))) {
|
|
return undefined;
|
|
}
|
|
const caFilePath = `${SSL_DIR}/ca-cert.pem`;
|
|
if (!fs_1.default.existsSync(caFilePath)) {
|
|
console.log(`${caFilePath} does not exist`);
|
|
return undefined;
|
|
}
|
|
return {
|
|
ca: fs_1.default.readFileSync(`${SSL_DIR}/ca-cert.pem`),
|
|
};
|
|
}
|