Merge pull request #1542 from nitro404/hotfix/datasource-name-mismatch-warning

Add warning for datasources with mismatched names
This commit is contained in:
Miroslav Bajtoš 2018-01-25 07:57:25 +01:00 committed by GitHub
commit 309b422425
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -375,6 +375,14 @@ DataSource.prototype.setup = function(name, settings) {
name = name || (connector && connector.name);
this.name = name;
if (typeof settings === 'object' && typeof settings.name === 'string' && name !== settings.name) {
console.warn(
'A datasource has a name of %j while a name of %j is specified in ' +
'its settings. Please adjust your configuration so these names match. ' +
'%j will be assigned as the actual datasource name.',
name, settings.name, name);
}
if (name && !connector) {
if (typeof name === 'object') {
// The first argument might be the connector itself