Fix the regression when 1st arg is the connector module
This commit is contained in:
parent
37ced0111e
commit
dff3367f3a
|
@ -215,8 +215,13 @@ DataSource.prototype.setup = function(name, settings) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
if (name && !connector) {
|
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
|
// The connector has not been resolved
|
||||||
if (name.match(/^\//)) {
|
else if (name.match(/^\//)) {
|
||||||
// try absolute path
|
// try absolute path
|
||||||
connector = require(name);
|
connector = require(name);
|
||||||
} else if (existsSync(__dirname + '/connectors/' + name + '.js')) {
|
} else if (existsSync(__dirname + '/connectors/' + name + '.js')) {
|
||||||
|
|
Loading…
Reference in New Issue