120 chars lines
This commit is contained in:
parent
8c09dfd230
commit
645a2cd442
@ -31,8 +31,8 @@
|
|||||||
// "maxparams" : false, // {int} Max number of formal params allowed per function
|
// "maxparams" : false, // {int} Max number of formal params allowed per function
|
||||||
// "maxdepth" : false, // {int} Max depth of nested blocks (within functions)
|
// "maxdepth" : false, // {int} Max depth of nested blocks (within functions)
|
||||||
// "maxstatements" : false, // {int} Max number statements per function
|
// "maxstatements" : false, // {int} Max number statements per function
|
||||||
// "maxcomplexity" : 8, // {int} Max cyclomatic complexity per function
|
// "maxcomplexity" : 6, // {int} Max cyclomatic complexity per function
|
||||||
// "maxlen" : 120, // {int} Max number of characters per line
|
"maxlen" : 120, // {int} Max number of characters per line
|
||||||
//
|
//
|
||||||
// // Relaxing
|
// // Relaxing
|
||||||
// "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
|
// "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
|
||||||
|
@ -26,7 +26,8 @@ var CartodbWindshaft = function(serverOptions) {
|
|||||||
var templateMaps = serverOptions.templateMaps;
|
var templateMaps = serverOptions.templateMaps;
|
||||||
|
|
||||||
if(serverOptions.cache_enabled) {
|
if(serverOptions.cache_enabled) {
|
||||||
console.log("cache invalidation enabled, varnish on ", serverOptions.varnish_host, ' ', serverOptions.varnish_port);
|
console.log("cache invalidation enabled, varnish on ", serverOptions.varnish_host, ' ',
|
||||||
|
serverOptions.varnish_port);
|
||||||
Cache.init(serverOptions.varnish_host, serverOptions.varnish_port, serverOptions.varnish_secret);
|
Cache.init(serverOptions.varnish_host, serverOptions.varnish_port, serverOptions.varnish_secret);
|
||||||
serverOptions.afterStateChange = function(req, data, callback) {
|
serverOptions.afterStateChange = function(req, data, callback) {
|
||||||
Cache.invalidate_db(req.params.dbname, req.params.table);
|
Cache.invalidate_db(req.params.dbname, req.params.table);
|
||||||
@ -51,7 +52,10 @@ var CartodbWindshaft = function(serverOptions) {
|
|||||||
var SurrogateKeysCache = require('./cache/surrogate_keys_cache'),
|
var SurrogateKeysCache = require('./cache/surrogate_keys_cache'),
|
||||||
NamedMapsCacheEntry = require('./cache/model/named_maps_entry'),
|
NamedMapsCacheEntry = require('./cache/model/named_maps_entry'),
|
||||||
VarnishHttpCacheBackend = require('./cache/backend/varnish_http'),
|
VarnishHttpCacheBackend = require('./cache/backend/varnish_http'),
|
||||||
varnishHttpCacheBackend = new VarnishHttpCacheBackend(serverOptions.varnish_host, serverOptions.varnish_http_port),
|
varnishHttpCacheBackend = new VarnishHttpCacheBackend(
|
||||||
|
serverOptions.varnish_host,
|
||||||
|
serverOptions.varnish_http_port
|
||||||
|
),
|
||||||
surrogateKeysCache = new SurrogateKeysCache(varnishHttpCacheBackend);
|
surrogateKeysCache = new SurrogateKeysCache(varnishHttpCacheBackend);
|
||||||
|
|
||||||
function invalidateNamedMap (owner, templateName) {
|
function invalidateNamedMap (owner, templateName) {
|
||||||
@ -124,7 +128,8 @@ var CartodbWindshaft = function(serverOptions) {
|
|||||||
//console.log("Skipping cache channel in route:\n" + req.route.path);
|
//console.log("Skipping cache channel in route:\n" + req.route.path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//console.log("Adding cache channel to route\n" + req.route.path + " not matching any in:\n" + mapCreateRoutes.join("\n"));
|
//console.log("Adding cache channel to route\n" + req.route.path + " not matching any in:\n" +
|
||||||
|
// mapCreateRoutes.join("\n"));
|
||||||
serverOptions.addCacheChannel(that, req, this);
|
serverOptions.addCacheChannel(that, req, this);
|
||||||
},
|
},
|
||||||
function sendResponse(err/*, added*/) {
|
function sendResponse(err/*, added*/) {
|
||||||
|
@ -281,14 +281,16 @@ module.exports = function(redisPool) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
me.beforeLayergroupCreate = function(req, requestMapConfig, callback) {
|
me.beforeLayergroupCreate = function(req, requestMapConfig, callback) {
|
||||||
mapConfigNamedLayersAdapter.getLayers(this.userByReq(req), requestMapConfig.layers, pgConnection, function(err, layers, datasource) {
|
mapConfigNamedLayersAdapter.getLayers(this.userByReq(req), requestMapConfig.layers, pgConnection,
|
||||||
if (err) {
|
function(err, layers, datasource) {
|
||||||
return callback(err);
|
if (err) {
|
||||||
}
|
return callback(err);
|
||||||
|
}
|
||||||
|
|
||||||
requestMapConfig.layers = layers;
|
requestMapConfig.layers = layers;
|
||||||
return callback(null, requestMapConfig, datasource);
|
return callback(null, requestMapConfig, datasource);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
me.afterLayergroupCreate = function(req, mapconfig, response, callback) {
|
me.afterLayergroupCreate = function(req, mapconfig, response, callback) {
|
||||||
@ -408,7 +410,8 @@ module.exports = function(redisPool) {
|
|||||||
var layergroup_id = req.params.token;
|
var layergroup_id = req.params.token;
|
||||||
var auth_token = req.params.auth_token;
|
var auth_token = req.params.auth_token;
|
||||||
|
|
||||||
//console.log("Checking authorization from signer " + signer + " for resource " + layergroup_id + " with auth_token " + auth_token);
|
//console.log("Checking authorization from signer " + signer + " for resource " + layergroup_id +
|
||||||
|
// " with auth_token " + auth_token);
|
||||||
var mapStore = req.app.mapStore;
|
var mapStore = req.app.mapStore;
|
||||||
if (!mapStore) {
|
if (!mapStore) {
|
||||||
throw new Error('Unable to retrieve map configuration token');
|
throw new Error('Unable to retrieve map configuration token');
|
||||||
@ -558,7 +561,12 @@ module.exports = function(redisPool) {
|
|||||||
//console.log("type of req.query.lzma is " + typeof(req.query.lzma));
|
//console.log("type of req.query.lzma is " + typeof(req.query.lzma));
|
||||||
|
|
||||||
// Decode (from base64)
|
// Decode (from base64)
|
||||||
var lzma = (new Buffer(req.query.lzma, 'base64').toString('binary')).split('').map(function(c) { return c.charCodeAt(0) - 128; });
|
var lzma = new Buffer(req.query.lzma, 'base64')
|
||||||
|
.toString('binary')
|
||||||
|
.split('')
|
||||||
|
.map(function(c) {
|
||||||
|
return c.charCodeAt(0) - 128;
|
||||||
|
});
|
||||||
|
|
||||||
// Decompress
|
// Decompress
|
||||||
lzmaWorker.decompress(
|
lzmaWorker.decompress(
|
||||||
@ -597,7 +605,8 @@ module.exports = function(redisPool) {
|
|||||||
req.params.signer = tksplit.shift();
|
req.params.signer = tksplit.shift();
|
||||||
if ( ! req.params.signer ) req.params.signer = user;
|
if ( ! req.params.signer ) req.params.signer = user;
|
||||||
else if ( req.params.signer !== user ) {
|
else if ( req.params.signer !== user ) {
|
||||||
var err = new Error('Cannot use map signature of user "' + req.params.signer + '" on database of user "' + user + '"');
|
var err = new Error('Cannot use map signature of user "' + req.params.signer + '" on database of user "' +
|
||||||
|
user + '"');
|
||||||
err.http_status = 403;
|
err.http_status = 403;
|
||||||
callback(err);
|
callback(err);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user