Windshaft-cartodb/lib/cartodb/server_options.js

89 lines
3.2 KiB
JavaScript
Raw Normal View History

2015-07-05 05:09:00 +08:00
var os = require('os');
2015-02-06 00:05:50 +08:00
var _ = require('underscore');
var windshaft = require('windshaft');
var OverviewsHandler = windshaft.OverviewsHandler;
var overviewsHandler = new OverviewsHandler({
zoom_level: 'CDB_ZoomFromScale(!scale_denominator!)'
});
var rendererConfig = _.defaults(global.environment.renderer || {}, {
cache_ttl: 60000, // milliseconds
statsInterval: 60000,
mapnik: {
poolSize: 8,
metatile: 2,
bufferSize: 64,
snapToGrid: false,
clipByBox2d: false,
2016-02-03 02:29:10 +08:00
limits: {}
},
http: {}
});
rendererConfig.mapnik.overviewsHandler = overviewsHandler;
2015-07-05 05:09:00 +08:00
// Perform keyword substitution in statsd
// See https://github.com/CartoDB/Windshaft-cartodb/issues/153
if ( global.environment.statsd ) {
if ( global.environment.statsd.prefix ) {
var host_token = os.hostname().split('.').reverse().join('.');
global.environment.statsd.prefix = global.environment.statsd.prefix.replace(/:host/, host_token);
}
}
module.exports = {
2015-07-05 05:09:00 +08:00
bind: {
port: global.environment.port,
host: global.environment.host
},
// This is for inline maps and table maps
base_url: global.environment.base_url_legacy || '/tiles/:table',
2014-02-05 02:04:59 +08:00
/// @deprecated with Windshaft-0.17.0
///base_url_notable: '/tiles',
// This is for Detached maps
//
2014-02-05 02:04:59 +08:00
// "maps" is the official, while
// "tiles/layergroup" is for backward compatibility up to 1.6.x
//
base_url_mapconfig: global.environment.base_url_detached || '(?:/maps|/tiles/layergroup)',
base_url_templated: global.environment.base_url_templated || '(?:/maps/named|/tiles/template)',
grainstore: {
map: {
// TODO: allow to specify in configuration
srid: 3857
},
datasource: global.environment.postgres,
cachedir: global.environment.millstone.cache_basedir,
mapnik_version: global.environment.mapnik_version,
mapnik_tile_format: global.environment.mapnik_tile_format || 'png',
default_layergroup_ttl: global.environment.mapConfigTTL || 7200
},
statsd: global.environment.statsd,
renderCache: {
ttl: rendererConfig.cache_ttl,
statsInterval: rendererConfig.statsInterval
},
2014-12-02 01:43:40 +08:00
renderer: {
mapnik: rendererConfig.mapnik,
torque: rendererConfig.torque,
2014-12-02 01:43:40 +08:00
http: rendererConfig.http
},
// Do not send unwatch on release. See http://github.com/CartoDB/Windshaft-cartodb/issues/161
redis: _.extend(global.environment.redis, {unwatchOnRelease: false}),
2011-10-13 21:22:54 +08:00
enable_cors: global.environment.enable_cors,
2012-05-02 02:00:14 +08:00
varnish_host: global.environment.varnish.host,
varnish_port: global.environment.varnish.port,
varnish_http_port: global.environment.varnish.http_port,
varnish_secret: global.environment.varnish.secret,
varnish_purge_enabled: global.environment.varnish.purge_enabled,
2015-04-27 22:20:55 +08:00
fastly: global.environment.fastly || {},
cache_enabled: global.environment.cache_enabled,
log_format: global.environment.log_format,
useProfiler: global.environment.useProfiler
};