From 92595b434848e1e0c6dee4187437121490dce15b Mon Sep 17 00:00:00 2001 From: Kevin Scroggins Date: Fri, 19 Jan 2018 12:44:41 -0500 Subject: [PATCH] Add warning for datasources with mismatched names --- lib/datasource.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/datasource.js b/lib/datasource.js index ed155c01..986ec39b 100644 --- a/lib/datasource.js +++ b/lib/datasource.js @@ -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