2018-03-29 21:33:52 +02:00
|
|
|
const logger = require('winston');
|
|
|
|
|
2018-03-27 21:32:07 +02:00
|
|
|
function mysql () {
|
2018-03-29 21:33:52 +02:00
|
|
|
this.database = 'default';
|
|
|
|
this.username = 'default';
|
|
|
|
this.password = 'default';
|
|
|
|
this.configure = (config) => {
|
|
|
|
if (!config) {
|
|
|
|
return logger.warn('No MySQL config received.');
|
2018-03-13 03:26:03 +01:00
|
|
|
}
|
2018-03-28 01:08:01 +02:00
|
|
|
// configure credentials
|
2018-03-29 21:33:52 +02:00
|
|
|
logger.info('configuring mysql...');
|
|
|
|
const { database, username, password } = config;
|
|
|
|
this.database = database;
|
|
|
|
this.username = username;
|
|
|
|
this.password = password;
|
2018-03-10 01:45:24 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-03-27 21:32:07 +02:00
|
|
|
module.exports = new mysql();
|