Fix the regression when 1st arg is the connector module

This commit is contained in:
Raymond Feng 2013-10-29 13:04:23 -07:00
parent 37ced0111e
commit dff3367f3a
1 changed files with 6 additions and 1 deletions

View File

@ -215,8 +215,13 @@ DataSource.prototype.setup = function(name, settings) {
this.name = name;
if (name && !connector) {
if (typeof name === 'object') {
// The first argument might be the connector itself
connector = name;
this.name = connector.name;
}
// The connector has not been resolved
if (name.match(/^\//)) {
else if (name.match(/^\//)) {
// try absolute path
connector = require(name);
} else if (existsSync(__dirname + '/connectors/' + name + '.js')) {