2015-07-05 05:09:00 +08:00
|
|
|
var os = require('os');
|
2015-02-06 00:05:50 +08:00
|
|
|
var _ = require('underscore');
|
2016-02-03 02:23:07 +08:00
|
|
|
var windshaft = require('windshaft');
|
|
|
|
var OverviewsHandler = windshaft.OverviewsHandler;
|
|
|
|
|
|
|
|
var overviewsHandler = new OverviewsHandler({
|
|
|
|
zoom_level: 'CDB_ZoomFromScale(!scale_denominator!)'
|
|
|
|
});
|
2015-04-01 21:11:58 +08:00
|
|
|
|
2015-07-05 02:41:22 +08:00
|
|
|
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: {}
|
2015-07-05 02:41:22 +08:00
|
|
|
},
|
|
|
|
http: {}
|
|
|
|
});
|
|
|
|
|
2016-02-03 02:23:07 +08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-05 02:41:22 +08:00
|
|
|
module.exports = {
|
2015-07-05 05:09:00 +08:00
|
|
|
bind: {
|
|
|
|
port: global.environment.port,
|
|
|
|
host: global.environment.host
|
|
|
|
},
|
2014-02-05 22:14:47 +08:00
|
|
|
// 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
|
2014-02-05 22:14:47 +08:00
|
|
|
///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
|
2014-02-05 22:14:47 +08:00
|
|
|
//
|
|
|
|
base_url_mapconfig: global.environment.base_url_detached || '(?:/maps|/tiles/layergroup)',
|
|
|
|
|
2015-07-10 17:24:32 +08:00
|
|
|
base_url_templated: global.environment.base_url_templated || '(?:/maps/named|/tiles/template)',
|
|
|
|
|
2012-09-20 00:52:13 +08:00
|
|
|
grainstore: {
|
2014-02-04 23:26:03 +08:00
|
|
|
map: {
|
|
|
|
// TODO: allow to specify in configuration
|
|
|
|
srid: 3857
|
|
|
|
},
|
2012-09-20 00:52:13 +08:00
|
|
|
datasource: global.environment.postgres,
|
2012-09-24 23:57:39 +08:00
|
|
|
cachedir: global.environment.millstone.cache_basedir,
|
2014-08-15 00:27:54 +08:00
|
|
|
mapnik_version: global.environment.mapnik_version,
|
2014-08-07 07:57:21 +08:00
|
|
|
mapnik_tile_format: global.environment.mapnik_tile_format || 'png',
|
2015-03-28 00:59:55 +08:00
|
|
|
default_layergroup_ttl: global.environment.mapConfigTTL || 7200
|
2012-09-20 00:52:13 +08:00
|
|
|
},
|
2014-02-12 22:27:42 +08:00
|
|
|
statsd: global.environment.statsd,
|
2013-02-25 23:53:57 +08:00
|
|
|
renderCache: {
|
2014-10-15 22:45:49 +08:00
|
|
|
ttl: rendererConfig.cache_ttl,
|
|
|
|
statsInterval: rendererConfig.statsInterval
|
2013-02-25 23:53:57 +08:00
|
|
|
},
|
2014-12-02 01:43:40 +08:00
|
|
|
renderer: {
|
2015-04-01 21:04:56 +08:00
|
|
|
mapnik: rendererConfig.mapnik,
|
2015-09-04 22:33:40 +08:00
|
|
|
torque: rendererConfig.torque,
|
2014-12-02 01:43:40 +08:00
|
|
|
http: rendererConfig.http
|
|
|
|
},
|
2015-07-05 02:41:22 +08:00
|
|
|
// 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,
|
2015-01-23 23:36:45 +08:00
|
|
|
varnish_http_port: global.environment.varnish.http_port,
|
2014-02-12 22:34:19 +08:00
|
|
|
varnish_secret: global.environment.varnish.secret,
|
2015-01-24 00:46:16 +08:00
|
|
|
varnish_purge_enabled: global.environment.varnish.purge_enabled,
|
2015-04-27 22:20:55 +08:00
|
|
|
fastly: global.environment.fastly || {},
|
2012-05-03 02:32:54 +08:00
|
|
|
cache_enabled: global.environment.cache_enabled,
|
2013-07-16 21:59:34 +08:00
|
|
|
log_format: global.environment.log_format,
|
|
|
|
useProfiler: global.environment.useProfiler
|
2014-02-19 13:45:29 +08:00
|
|
|
};
|