Remove settings' app_root
This commit is contained in:
parent
f92d50cccf
commit
84b80547c2
17
app.js
17
app.js
@ -9,7 +9,6 @@
|
|||||||
* environments: [development, test, production]
|
* environments: [development, test, production]
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
var _ = require('underscore');
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
@ -31,10 +30,8 @@ if (availableEnvironments.indexOf(ENV) === -1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set Node.js app settings and boot
|
// set Node.js app settings and boot
|
||||||
global.settings = require(__dirname + '/config/settings');
|
global.settings = require('./config/environments/' + ENV);
|
||||||
var env = require(__dirname + '/config/environments/' + ENV);
|
global.settings.api_hostname = require('os').hostname().split('.')[0];
|
||||||
env.api_hostname = require('os').hostname().split('.')[0];
|
|
||||||
_.extend(global.settings, env);
|
|
||||||
|
|
||||||
global.log4js = require('log4js');
|
global.log4js = require('log4js');
|
||||||
var log4jsConfig = {
|
var log4jsConfig = {
|
||||||
@ -42,8 +39,8 @@ var log4jsConfig = {
|
|||||||
replaceConsole: true
|
replaceConsole: true
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( env.log_filename ) {
|
if ( global.settings.log_filename ) {
|
||||||
var logFilename = path.resolve(env.log_filename);
|
var logFilename = path.resolve(global.settings.log_filename);
|
||||||
var logDirectory = path.dirname(logFilename);
|
var logDirectory = path.dirname(logFilename);
|
||||||
if (!fs.existsSync(logDirectory)) {
|
if (!fs.existsSync(logDirectory)) {
|
||||||
console.error("Log filename directory does not exist: " + logDirectory);
|
console.error("Log filename directory does not exist: " + logDirectory);
|
||||||
@ -69,11 +66,11 @@ if ( ! global.settings.base_url ) {
|
|||||||
|
|
||||||
var version = require("./package").version;
|
var version = require("./package").version;
|
||||||
|
|
||||||
var server = require('app/server')();
|
var server = require('./app/server')();
|
||||||
server.listen(global.settings.node_port, global.settings.node_host, function() {
|
server.listen(global.settings.node_port, global.settings.node_host, function() {
|
||||||
console.log(
|
console.log(
|
||||||
"CartoDB SQL API %s listening on %s:%s with base_url %s (%s)",
|
"CartoDB SQL API %s listening on %s:%s with base_url %s PID=%d (%s)",
|
||||||
version, global.settings.node_host, global.settings.node_port, global.settings.base_url, ENV
|
version, global.settings.node_host, global.settings.node_port, global.settings.base_url, process.pid, ENV
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
var path = require('path');
|
|
||||||
|
|
||||||
module.exports.app_root = path.join(__dirname, '..');
|
|
||||||
|
|
@ -1,5 +1 @@
|
|||||||
var _ = require('underscore');
|
global.settings = require('../config/environments/test');
|
||||||
|
|
||||||
global.settings = require(__dirname + '/../config/settings');
|
|
||||||
var env = require(__dirname + '/../config/environments/test');
|
|
||||||
_.extend(global.settings, env);
|
|
||||||
|
Loading…
Reference in New Issue
Block a user