2018-03-29 12:33:52 -07:00
|
|
|
const logger = require('winston');
|
|
|
|
|
2018-04-17 14:03:50 -07:00
|
|
|
function MysqlConfig () {
|
2018-03-29 12:33:52 -07:00
|
|
|
this.database = 'default';
|
|
|
|
this.username = 'default';
|
|
|
|
this.password = 'default';
|
2018-03-29 12:46:20 -07:00
|
|
|
this.update = (config) => {
|
2018-03-29 12:33:52 -07:00
|
|
|
if (!config) {
|
|
|
|
return logger.warn('No MySQL config received.');
|
2018-03-12 19:26:03 -07:00
|
|
|
}
|
2018-03-27 16:08:01 -07:00
|
|
|
// configure credentials
|
2018-03-29 12:33:52 -07:00
|
|
|
logger.info('configuring mysql...');
|
|
|
|
const { database, username, password } = config;
|
|
|
|
this.database = database;
|
|
|
|
this.username = username;
|
|
|
|
this.password = password;
|
2018-03-09 16:45:24 -08:00
|
|
|
};
|
2018-04-17 12:57:53 -07:00
|
|
|
}
|
2018-03-09 16:45:24 -08:00
|
|
|
|
2018-04-17 14:03:50 -07:00
|
|
|
module.exports = new MysqlConfig();
|