Use DEBUG or NODE_DEBUG env to override the debug flag

This commit is contained in:
Raymond Feng 2013-08-18 23:11:32 -07:00
parent 9482d3c7de
commit 0fd167a41d
1 changed files with 8 additions and 1 deletions

View File

@ -176,7 +176,14 @@ DataSource.prototype.setup = function(name, settings) {
// just save everything we get
this.name = name;
this.settings = settings;
this.settings = settings || {};
// Check the debug env settings
var debugEnv = process.env.DEBUG || process.env.NODE_DEBUG || '';
var debugModules = debugEnv.split(/[\s,]+/);
if(debugModules.indexOf('loopback') !== -1) {
this.settings.debug = true;
}
// Disconnected by default
this.connected = false;