Add warning for datasources with mismatched names

This commit is contained in:
Kevin Scroggins 2018-01-19 12:44:41 -05:00 committed by Miroslav Bajtoš
parent 943fed851e
commit 92595b4348
No known key found for this signature in database
GPG Key ID: 6F2304BA9361C7E3
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