Merge pull request #6959 from kirrg001/improvement/db-connection

improvement: improve db/connection.js readability
This commit is contained in:
Hannah Wolfe 2016-06-10 10:17:38 +01:00 committed by GitHub
commit 015802b6eb

View File

@ -1,6 +1,5 @@
var knex = require('knex'),
config = require('../../config'),
dbConfig = config.database,
knexInstance;
function configure(dbConfig) {
@ -47,8 +46,8 @@ function configure(dbConfig) {
return dbConfig;
}
if (!knexInstance && dbConfig && dbConfig.client) {
knexInstance = knex(configure(dbConfig));
if (!knexInstance && config.database && config.database.client) {
knexInstance = knex(configure(config.database));
}
module.exports = knexInstance;