diff --git a/lib/datasource.js b/lib/datasource.js index b225dabc..83b13d03 100644 --- a/lib/datasource.js +++ b/lib/datasource.js @@ -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')) {