({
dbUrl,
cert,
}: {
dbUrl?: string;
cert?: string;
})
| 53 | * - if database url is missing, it will throw an exception |
| 54 | */ |
| 55 | export function getDatabaseUrl({ |
| 56 | dbUrl, |
| 57 | cert, |
| 58 | }: { |
| 59 | dbUrl?: string; |
| 60 | cert?: string; |
| 61 | }) { |
| 62 | if (!dbUrl) return ''; |
| 63 | |
| 64 | const certLocation = createCertFile({ cert }); |
| 65 | if (!certLocation) return dbUrl; |
| 66 | |
| 67 | const join = dbUrl.indexOf('?') > -1 ? '&' : '?'; |
| 68 | return dbUrl + `${join}ssl=true&sslrootcert=${certLocation}`; |
| 69 | } |
no test coverage detected