2018-03-29 21:33:52 +02:00
|
|
|
const logger = require('winston');
|
|
|
|
|
2018-04-17 23:03:50 +02:00
|
|
|
function MysqlConfig () {
|
2018-03-29 21:33:52 +02:00
|
|
|
this.database = 'default';
|
|
|
|
this.username = 'default';
|
|
|
|
this.password = 'default';
|
2018-03-29 21:46:20 +02:00
|
|
|
this.update = (config) => {
|
2018-03-29 21:33:52 +02:00
|
|
|
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-04-17 21:57:53 +02:00
|
|
|
}
|
2018-03-10 01:45:24 +01:00
|
|
|
|
2018-04-17 23:03:50 +02:00
|
|
|
module.exports = new MysqlConfig();
|