CartoDB-SQL-API/app/middlewares/connection-params.js
Daniel García Aubert 868dc798b2 Cosmetic line break
2018-02-22 15:59:13 +01:00

22 lines
671 B
JavaScript

module.exports = function connectionParams (userDatabaseService) {
return function connectionParamsMiddleware (req, res, next) {
const { user, api_key: apikeyToken, authenticated } = res.locals;
userDatabaseService.getConnectionParams(user, apikeyToken, authenticated,
function (err, userDbParams, authDbParams) {
if (req.profiler) {
req.profiler.done('getConnectionParams');
}
if (err) {
return next(err);
}
res.locals.userDbParams = userDbParams;
res.locals.authDbParams = authDbParams;
next();
});
};
};