From 5c80184a1d5fff13a6b1026aebb2752b8d7aa655 Mon Sep 17 00:00:00 2001 From: Karl Berggren Date: Thu, 1 Jan 2026 02:53:47 +0100 Subject: [PATCH] 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 --- server/core/db.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/core/db.js b/server/core/db.js index b729282a4..3ce2e8bfb 100644 --- a/server/core/db.js +++ b/server/core/db.js @@ -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) {