INNER CODE UNIT · TypeScript
booleanFor
tot-ra/graphql-schema-registry · src/database/index.ts:9
function booleanFor(variable: string | undefined, defaultValue = 'false') {
return (variable || defaultValue).toLowerCase() === 'true';
}
function parseDbSsl() {
if (!booleanFor(process.env.DB_SSL)) {
return undefined;
}
const ssl: { rejectUnauthorized: boolean; ca?: string } = {
rejectUnauthorized: booleanFor(
process.env.DB_SSL_REJECT_UNAUTHORIZED,
'true'
),
};
if (process.env.DB_SSL_CA) {
ssl.ca = process.env.DB_SSL_CA.replace(/\\n/g, '\n');