mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-19 17:30:32 +02:00
Merge pull request #230 from lirantal/enhancement-126-using-chalk
Enhancement 126 using chalk
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
var glob = require('glob');
|
||||
var glob = require('glob'),
|
||||
chalk = require('chalk');
|
||||
|
||||
/**
|
||||
* Module init function.
|
||||
@@ -16,19 +17,17 @@ module.exports = function() {
|
||||
glob('./config/env/' + process.env.NODE_ENV + '.js', {
|
||||
sync: true
|
||||
}, function(err, environmentFiles) {
|
||||
console.log();
|
||||
if (!environmentFiles.length) {
|
||||
if (process.env.NODE_ENV) {
|
||||
console.error('\x1b[31m', 'No configuration file found for "' + process.env.NODE_ENV + '" environment using development instead');
|
||||
console.error(chalk.red('No configuration file found for "' + process.env.NODE_ENV + '" environment using development instead'));
|
||||
} else {
|
||||
console.error('\x1b[31m', 'NODE_ENV is not defined! Using default development environment');
|
||||
console.error(chalk.red('NODE_ENV is not defined! Using default development environment'));
|
||||
}
|
||||
|
||||
process.env.NODE_ENV = 'development';
|
||||
} else {
|
||||
console.log('\x1b[7m', 'Application loaded using the "' + process.env.NODE_ENV + '" environment configuration');
|
||||
console.log(chalk.black.bgWhite('Application loaded using the "' + process.env.NODE_ENV + '" environment configuration'));
|
||||
}
|
||||
console.log('\x1b[0m');
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,8 @@
|
||||
"grunt-cli": "~0.1.13",
|
||||
"glob": "~4.0.5",
|
||||
"async": "~0.9.0",
|
||||
"nodemailer": "~1.3.0"
|
||||
"nodemailer": "~1.3.0",
|
||||
"chalk": "~0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"supertest": "~0.14.0",
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
*/
|
||||
var init = require('./config/init')(),
|
||||
config = require('./config/config'),
|
||||
mongoose = require('mongoose');
|
||||
mongoose = require('mongoose'),
|
||||
chalk = require('chalk');
|
||||
|
||||
/**
|
||||
* Main application entry file.
|
||||
@@ -14,8 +15,8 @@ var init = require('./config/init')(),
|
||||
// Bootstrap db connection
|
||||
var db = mongoose.connect(config.db, function(err) {
|
||||
if (err) {
|
||||
console.error('\x1b[31m', 'Could not connect to MongoDB!');
|
||||
console.log(err);
|
||||
console.error(chalk.red('Could not connect to MongoDB!'));
|
||||
console.log(chalk.red(err));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user