feat: add support for database connection via socketPath when using mysql2 driver (#7839)

* Added support for database socketPath in configure file when using dbClient mysql2 (mysql or mariadb)

* refactor: mysql dbConfig to conditionally set socketPath

Updated database configuration to conditionally include socketPath from WIKI.config.

* fix: socketPath assignment typo

---------

Co-authored-by: Nicolas Giard <github@ngpixel.com>
pull/7822/merge
Karl Berggren 8 months ago committed by GitHub
parent a02e0131c1
commit 5c80184a1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -91,6 +91,13 @@ module.exports = {
dbConfig.ssl = sslOptions
}
// Prune host and port if socketPath is configured
if (WIKI.config.db.socketPath) {
const { host, port, ...prunedConfig} = dbConfig
dbConfig = prunedConfig
dbConfig.socketPath = WIKI.config.db.socketPath.toString()
}
// Fix mysql boolean handling...
dbConfig.typeCast = (field, next) => {
if (field.type === 'TINY' && field.length === 1) {

Loading…
Cancel
Save