2018-10-23 23:45:42 +08:00
|
|
|
'use strict';
|
|
|
|
|
2018-03-22 19:30:51 +08:00
|
|
|
module.exports = function getDatabaseConnectionParams (params) {
|
|
|
|
const dbParams = {};
|
|
|
|
|
|
|
|
if (params.dbuser) {
|
|
|
|
dbParams.user = params.dbuser;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (params.dbpassword) {
|
|
|
|
dbParams.pass = params.dbpassword;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (params.dbhost) {
|
|
|
|
dbParams.host = params.dbhost;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (params.dbport) {
|
|
|
|
dbParams.port = params.dbport;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (params.dbname) {
|
|
|
|
dbParams.dbname = params.dbname;
|
|
|
|
}
|
|
|
|
|
|
|
|
return dbParams;
|
|
|
|
};
|