Add environment variable and snap configuration option for results per page

This commit is contained in:
John Supplee 2021-03-19 21:09:39 +02:00
parent 0ebb427a00
commit 9e8399612b
2 changed files with 10 additions and 1 deletions

View file

@ -461,6 +461,11 @@ function buildProjection(query) {
skip = query.params.skip;
}
let limit = DEFAULT_LIMIT;
const configLimit = parseInt(process.env.RESULTS_PER_PAGE, 10);
if (!isNaN(configLimit) && configLimit > 0) {
limit = configLimit;
}
if (query.params.hasOperator(OPERATOR_LIMIT)) {
limit = query.params.getPredicate(OPERATOR_LIMIT);
}