"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")); const grab_dir_names_1 = __importDefault(require("./names/grab-dir-names")); const path_1 = __importDefault(require("path")); /** * # Grab SSL */ function grabDbSSL() { let maxscaleSSLCaCertFileFinal; try { const { maxscaleSSLCaCertFile } = (0, grab_dir_names_1.default)(); maxscaleSSLCaCertFileFinal = maxscaleSSLCaCertFile; } catch (error) { } const caProivdedPath = process.env.DSQL_SSL_CA_CERT || maxscaleSSLCaCertFileFinal; if (!(caProivdedPath === null || caProivdedPath === void 0 ? void 0 : caProivdedPath.match(/./))) { return undefined; } const caFilePath = path_1.default.resolve(process.cwd(), caProivdedPath); if (!fs_1.default.existsSync(caFilePath)) { console.log(`${caFilePath} does not exist`); return undefined; } return { ca: fs_1.default.readFileSync(caFilePath), rejectUnauthorized: false, }; }