Include feature flag to enable/disable stats

This commit is contained in:
Mario de Frutos 2017-05-09 12:51:22 +02:00
parent 15c68711aa
commit 759d28f12f

View File

@ -7,6 +7,14 @@ function StatsBackend(rendererCache) {
module.exports = StatsBackend; module.exports = StatsBackend;
StatsBackend.prototype.getStats = function(params, dbConnection, mapConfigProvider, callback) { StatsBackend.prototype.getStats = function(params, dbConnection, mapConfigProvider, callback) {
var layerStats = windshaftStats(); var enabledFeatures = global.environment.enabledFeatures;
var layerMetadataEnabled = enabledFeatures ? enabledFeatures.layerMetadata : false;
var layerStats;
if (layerMetadataEnabled) {
layerStats = windshaftStats();
layerStats.getStats(this.rendererCache, params, dbConnection, mapConfigProvider, callback); layerStats.getStats(this.rendererCache, params, dbConnection, mapConfigProvider, callback);
} else {
layerStats = windshaftStats('torque');
layerStats.getStats(this.rendererCache, params, dbConnection, mapConfigProvider, callback);
}
}; };