diff --git a/lib/datasource.js b/lib/datasource.js index a667e4c3..f3a239ca 100644 --- a/lib/datasource.js +++ b/lib/datasource.js @@ -165,6 +165,57 @@ DataSource.prototype._setupConnector = function () { } }; +// List possible connector module names +function connectorModuleNames(name) { + var names = [name]; // Check the name as is + if (!name.match(/^\//)) { + names.push('./connectors/' + name); // Check built-in connectors + if (name.indexOf('loopback-connector-') !== 0) { + names.push('loopback-connector-' + name); // Try loopback-connector- + } + } + return names; +} + +// testable with DI +function tryModules(names, loader) { + var mod; + loader = loader || require; + for(var m =0; m