Skip to content

Commit

Permalink
Fixed up --verbose comand line option again.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikermcneil committed Oct 2, 2013
1 parent 6ef149a commit c02ba53
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/app/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module.exports = function (sails) {

return function load (configOverride, cb) {


// Provide access to module loader from the Sails object
sails.modules = Modules;

Expand All @@ -42,9 +43,9 @@ module.exports = function (sails) {
configOverride = configOverride || {};

// Environment variables should override other config
configOverride.environment = process.env.NODE_ENV;
configOverride.environment = process.env.NODE_ENV || "development";
configOverride.port = process.env.PORT || configOverride.port;
sails.config = util.clone(configOverride);
sails.config = util.cloneDeep(configOverride);

async.auto({

Expand Down
7 changes: 7 additions & 0 deletions lib/configuration/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ module.exports = function (sails) {
*/
mapOverrides: function (cb) {

// TODO: move this into `lib/app/load` instead

// Take the overrides + app path
// and clone and save them for later
var overrides = util.cloneDeep(sails.config);

// Map command line shortcut options to proper configuration
// Only needs to be done for command-line or ENV overrides
// which do not match their configuration file equivalents
if (sails.config.dev && sails.config.prod) {
var err = new Error ('You cannot specify both production AND development!');
sails.log.error(err);
Expand All @@ -59,6 +63,9 @@ module.exports = function (sails) {
if (overrides.prod) {
overrides.environment = 'production';
}
if (overrides.verbose) {
overrides.log = { level: 'verbose' };
}

// Pass on overrides object
cb(null, overrides);
Expand Down
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var Sails = require('./app');

// Instantiate a Sails by default
// (maintains legacy support)
module.exports = new Sails();

0 comments on commit c02ba53

Please sign in to comment.