Skip to content

Commit

Permalink
fix: Migration load config.seuqelize for function type config support.
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed May 11, 2017
1 parent d44d9bf commit 773c750
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions History.md
@@ -1,3 +1,8 @@
2.1.3 / 2017-05-11
==================

* fix: Migration load config.seuqelize for function type config support.

2.1.2 / 2017-05-11
==================

Expand Down
7 changes: 4 additions & 3 deletions lib/database.js
Expand Up @@ -6,9 +6,10 @@ function requireConfig(name) {
const configPath = path.resolve(`./config/config.${name}.js`);
if (!fs.existsSync(configPath)) { return {}; }

let config = require(configPath).sequelize;
if ((typeof config) === 'function') { config = config(); }
return config || {};
let config = require(configPath);
// FIXME: config init with function need send appInfo argument.
if ((typeof config) === 'function') { config = config({}); }
return config.sequelize || {};
}

const defaultConfig = requireConfig('default');
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "egg-sequelize",
"version": "2.1.2",
"version": "2.1.3",
"description": "egg Sequelize plugin",
"eggPlugin": {
"name": "sequelize"
Expand Down

0 comments on commit 773c750

Please sign in to comment.