Remove req2params middleware from ported server options

This commit is contained in:
Daniel García Aubert 2018-03-16 20:02:18 +01:00
parent a2fa92abf1
commit ed9083de24

View File

@ -49,42 +49,6 @@ module.exports = _.extend({}, serverOptions, {
log_format: null, // do not log anything log_format: null, // do not log anything
afterLayergroupCreateCalls: 0, afterLayergroupCreateCalls: 0,
useProfiler: true, useProfiler: true,
req2params: function(req, res, callback){
if ( req.query.testUnexpectedError ) {
return callback('test unexpected error');
}
// this is in case you want to test sql parameters eg ...png?sql=select * from my_table limit 10
req.params = _.extend({}, req.params);
if (req.params.token) {
req.params.token = LayergroupToken.parse(req.params.token).token;
}
_.extend(req.params, req.query);
req.params.user = 'localhost';
res.locals.user = 'localhost';
req.params.dbhost = global.environment.postgres.host;
req.params.dbport = req.params.dbport || global.environment.postgres.port;
req.params.dbuser = 'test_windshaft_publicuser';
if (req.params.dbname !== 'windshaft_test2') {
req.params.dbuser = 'test_windshaft_cartodb_user_1';
}
req.params.dbname = 'test_windshaft_cartodb_user_1_db';
// add all params to res.locals
res.locals = _.extend({}, req.params);
// increment number of calls counter
global.req2params_calls = global.req2params_calls ? global.req2params_calls + 1 : 1;
// send the finished req object on
callback(null,req);
},
afterLayergroupCreate: function(req, cfg, res, callback) { afterLayergroupCreate: function(req, cfg, res, callback) {
res.layercount = cfg.layers.length; res.layercount = cfg.layers.length;
// config.afterLayergroupCreateCalls++; // config.afterLayergroupCreateCalls++;