Skip to content

Commit

Permalink
fix(config): json parsing (e.g. ssl) (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
lalashkin authored Nov 7, 2023
1 parent 0398abc commit e7ae5a6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@ export const connectionOptions = (() => {

convertNamedPlaceholders = options.namedPlaceholders === 'false' ? null : require('named-placeholders')();

for (const key in ['dateStrings', 'flags', 'ssl']) {
for (const key of ['dateStrings', 'flags', 'ssl']) {
const value = options[key];

if (typeof value === 'string') {
try {
options[key] = JSON.parse(value);
} catch {}
} catch (err) {
console.log(
`^3Failed to parse property ${key} in configuration (${err})!^0`
)
}
}
}

Expand Down

0 comments on commit e7ae5a6

Please sign in to comment.