Allow passing environment configuration name via NODE_ENV to app.js
Also print environment configuration name on app start
This commit is contained in:
parent
a1adabdeb8
commit
4013e84b15
2
NEWS.md
2
NEWS.md
@ -11,6 +11,8 @@ Enhancements:
|
|||||||
* Allow configuring log_format (#131)
|
* Allow configuring log_format (#131)
|
||||||
* Use log4js for logging (#136)
|
* Use log4js for logging (#136)
|
||||||
* Include version in startup log
|
* Include version in startup log
|
||||||
|
* Allow passing environment configuration name via NODE_ENV to app.js
|
||||||
|
* Print environment configuration name on app start
|
||||||
|
|
||||||
1.8.3 - 2014-02-10
|
1.8.3 - 2014-02-10
|
||||||
------------------
|
------------------
|
||||||
|
12
app.js
12
app.js
@ -11,11 +11,14 @@
|
|||||||
*/
|
*/
|
||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
|
|
||||||
|
if ( process.argv[2] ) ENV = process.argv[2];
|
||||||
|
else if ( process.env['NODE_ENV'] ) ENV = process.env['NODE_ENV'];
|
||||||
|
else ENV = 'development';
|
||||||
|
|
||||||
// sanity check arguments
|
// sanity check arguments
|
||||||
var ENV = process.argv[2];
|
|
||||||
if (ENV != 'development' && ENV != 'production' && ENV != 'test' && ENV != 'staging' ) {
|
if (ENV != 'development' && ENV != 'production' && ENV != 'test' && ENV != 'staging' ) {
|
||||||
console.error("\n./app [environment]");
|
console.error("\nnode app.js [environment]");
|
||||||
console.error("environments: [development, staging, production, test]");
|
console.error("environments: development, staging, production, test");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +55,8 @@ var app = require(global.settings.app_root + '/app/controllers/app')();
|
|||||||
app.listen(global.settings.node_port, global.settings.node_host, function() {
|
app.listen(global.settings.node_port, global.settings.node_host, function() {
|
||||||
console.log("CartoDB SQL API " + version + " listening on " +
|
console.log("CartoDB SQL API " + version + " listening on " +
|
||||||
global.settings.node_host + ":" + global.settings.node_port +
|
global.settings.node_host + ":" + global.settings.node_port +
|
||||||
" with base_url " + global.settings.base_url);
|
" with base_url " + global.settings.base_url
|
||||||
|
+ " (" + ENV + ")");
|
||||||
});
|
});
|
||||||
|
|
||||||
process.on('uncaughtException', function(err) {
|
process.on('uncaughtException', function(err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user