implementing MariaDB config.load
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
D3vision 2023-04-01 14:10:21 +02:00
parent fe29695c0f
commit 7f065f427f

View File

@ -14,6 +14,7 @@ class MariaDB {
if (!config) if (!config)
Util.fatal(new Error('No config options provided!')); Util.fatal(new Error('No config options provided!'));
this.load = config.options.load;
this.config = config; this.config = config;
const { MARIA_HOST: hostStr, MARIA_USER: user, MARIA_PORT: port, MARIA_PASS: password, MARIA_DB: database } = config; const { MARIA_HOST: hostStr, MARIA_USER: user, MARIA_PORT: port, MARIA_PASS: password, MARIA_DB: database } = config;
const hosts = hostStr.split(','); const hosts = hostStr.split(',');
@ -36,6 +37,10 @@ class MariaDB {
async init () { async init () {
if (!this.load) {
this.logger.info(`Not loading MariaDB connection`);
return;
}
this.logger.status(`Creating${this._cluster ? ' cluster' : ''} connection pool`); this.logger.status(`Creating${this._cluster ? ' cluster' : ''} connection pool`);
if (this._cluster) { if (this._cluster) {
this.pool = mysql.createPoolCluster(this.config.options.cluster); this.pool = mysql.createPoolCluster(this.config.options.cluster);