Require carto_data only after setting the global env (closes #28)

This one is for "cluster.js", the previous was for app.js
This commit is contained in:
Sandro Santilli 2012-07-10 20:38:54 +02:00
parent d18cf96007
commit c918b09e64

View File

@ -19,7 +19,6 @@ if (ENV != 'development' && ENV != 'production'){
var _ = require('underscore') var _ = require('underscore')
, Step = require('step') , Step = require('step')
, cartoData = require('./lib/cartodb/carto_data')
, CartodbWindshaft = require('./lib/cartodb/cartodb_windshaft'); , CartodbWindshaft = require('./lib/cartodb/cartodb_windshaft');
@ -28,6 +27,10 @@ global.settings = require(__dirname + '/config/settings');
global.environment = require(__dirname + '/config/environments/' + ENV); global.environment = require(__dirname + '/config/environments/' + ENV);
_.extend(global.settings, global.environment); _.extend(global.settings, global.environment);
// Include cart_data.js only _after_ the "global" variable is set
// See https://github.com/Vizzuality/Windshaft-cartodb/issues/28
var cartoData = require('./lib/cartodb/carto_data');
var Windshaft = require('windshaft'); var Windshaft = require('windshaft');
var serverOptions = require('./lib/cartodb/server_options'); var serverOptions = require('./lib/cartodb/server_options');
@ -39,4 +42,4 @@ cluster(ws)
.set('workers', 1) .set('workers', 1)
.listen(global.environment.port, global.environment.host); .listen(global.environment.port, global.environment.host);
console.log("Windshaft tileserver started on port " + global.environment.port); console.log("Windshaft tileserver started on port " + global.environment.port);