Pass only needed params to create layergroup map config provider

This commit is contained in:
Daniel García Aubert 2018-03-22 19:36:42 +01:00
parent 6b7c2675f1
commit d029f81992

View File

@ -319,16 +319,26 @@ function prepareAdapterMapConfig (mapConfigAdapter) {
function createLayergroup (mapBackend, userLimitsApi, pgConnection, affectedTablesCache) {
return function createLayergroupMiddleware (req, res, next) {
const requestMapConfig = req.body;
const { context, user } = res.locals;
const { context } = res.locals;
const { user, cache_buster, api_key } = res.locals;
const { dbuser, dbname, dbpassword, dbhost, dbport } = res.locals;
const params = {
cache_buster, api_key,
dbuser, dbname, dbpassword, dbhost, dbport
};
const datasource = context.datasource || Datasource.EmptyDatasource();
const mapConfig = new MapConfig(requestMapConfig, datasource);
const mapConfigProvider = new CreateLayergroupMapConfigProvider(
mapConfig,
user,
userLimitsApi,
pgConnection,
affectedTablesCache,
res.locals
params
);
res.locals.mapConfig = mapConfig;