mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-03 22:20:56 +00:00
fix(config): json parsing (e.g. ssl) (#203)
This commit is contained in:
1 parent
0398abc501
commit
e7ae5a6f30
1 file changed
+6
-2
+6
-2
@@ -80,13 +80,17 @@ export const connectionOptions = (() => {
|
|||||||
|
|
||||||
convertNamedPlaceholders = options.namedPlaceholders === 'false' ? null : require('named-placeholders')();
|
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];
|
const value = options[key];
|
||||||
|
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
try {
|
try {
|
||||||
options[key] = JSON.parse(value);
|
options[key] = JSON.parse(value);
|
||||||
} catch {}
|
} catch (err) {
|
||||||
|
console.log(
|
||||||
|
`^3Failed to parse property ${key} in configuration (${err})!^0`
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user