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>
This commit is contained in:
Karl Berggren
2025-12-31 20:53:47 -05:00
committed by GitHub
co-authored by Nicolas Giard
parent a02e0131c1
commit 5c80184a1d
+7
View File
@@ -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) {