actually apply mariadb credentials

This commit is contained in:
Erik 2022-11-15 18:16:13 +02:00
parent 5fe415dfcf
commit 1756b1780a
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -11,6 +11,8 @@ class MariaDB {
if (!config) Util.fatal(new Error('No config options provided!')); if (!config) Util.fatal(new Error('No config options provided!'));
this.config = config; this.config = config;
const { MARIA_HOST: host, MARIA_USER: user, MARIA_PORT: port, MARIA_PASS: password, MARIA_DB: database } = config;
this._credentials = { host, user, port, password, database };
this.pool = null; this.pool = null;
this.ready = false; this.ready = false;
@ -26,7 +28,7 @@ class MariaDB {
init () { init () {
this.logger.status(`Creating connection pool`); this.logger.status(`Creating connection pool`);
this.pool = mysql.createPool(this.config.options.client); this.pool = mysql.createPool({ ...this.config.options.client, ...this._credentials });
this.pool.on('connection', (connection) => { this.pool.on('connection', (connection) => {
this.logger.debug(`New connection: ${connection?.threadId || null}`); this.logger.debug(`New connection: ${connection?.threadId || null}`);