2011-09-05 07:00:41 +08:00
|
|
|
/*
|
2011-10-07 22:38:28 +08:00
|
|
|
* Windshaft-CartoDB
|
|
|
|
* ===============
|
|
|
|
*
|
|
|
|
* ./app.js [environment]
|
|
|
|
*
|
|
|
|
* environments: [development, production]
|
|
|
|
*/
|
2011-09-05 07:00:41 +08:00
|
|
|
|
|
|
|
|
|
|
|
// sanity check
|
|
|
|
var ENV = process.argv[2]
|
|
|
|
if (ENV != 'development' && ENV != 'production'){
|
2011-10-07 22:38:28 +08:00
|
|
|
console.error("\nnode app.js [environment]");
|
|
|
|
console.error("environments: [development, production]\n");
|
|
|
|
process.exit(1);
|
2011-09-05 07:00:41 +08:00
|
|
|
}
|
|
|
|
|
2011-10-07 22:38:28 +08:00
|
|
|
var _ = require('underscore')
|
|
|
|
, Step = require('step')
|
2011-10-13 19:17:00 +08:00
|
|
|
, CartodbWindshaft = require('./lib/cartodb/cartodb_windshaft');
|
2011-09-05 07:00:41 +08:00
|
|
|
|
|
|
|
// set environment specific variables
|
|
|
|
global.settings = require(__dirname + '/config/settings');
|
|
|
|
global.environment = require(__dirname + '/config/environments/' + ENV);
|
|
|
|
_.extend(global.settings, global.environment);
|
|
|
|
|
2012-07-10 15:49:56 +08:00
|
|
|
// 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');
|
|
|
|
|
2011-09-05 07:00:41 +08:00
|
|
|
var Windshaft = require('windshaft');
|
|
|
|
var serverOptions = require('./lib/cartodb/server_options');
|
|
|
|
|
2011-10-13 19:17:00 +08:00
|
|
|
ws = CartodbWindshaft(serverOptions);
|
2012-05-02 02:00:14 +08:00
|
|
|
ws.listen(global.environment.port);
|
|
|
|
console.log("Windshaft tileserver started on port " + global.environment.port);
|