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

pull/7839/head
jjabba 6 months ago
parent 54d21ae538
commit c8091490b6

@ -31,6 +31,7 @@ module.exports = {
let dbClient = null
let dbConfig = (!_.isEmpty(process.env.DATABASE_URL)) ? process.env.DATABASE_URL : {
host: WIKI.config.db.host.toString(),
socketPath: WIKI.config.db.socketPath.toString(),
user: WIKI.config.db.user.toString(),
password: WIKI.config.db.pass.toString(),
database: WIKI.config.db.db.toString(),
@ -91,6 +92,12 @@ module.exports = {
dbConfig.ssl = sslOptions
}
// Prune host and port if socketPath is configured
if (dbConfig.socketPath) {
const { host, port, ...prunedConfig} = dbConfig;
dbConfig = prunedConfig;
}
// Fix mysql boolean handling...
dbConfig.typeCast = (field, next) => {
if (field.type === 'TINY' && field.length === 1) {

Loading…
Cancel
Save