rate limit analysis catalog endpoint
This commit is contained in:
parent
cbfeb0158e
commit
48a7d28aa6
@ -354,6 +354,7 @@ var config = {
|
|||||||
dataview: false,
|
dataview: false,
|
||||||
dataview_search: false,
|
dataview_search: false,
|
||||||
analysis: false,
|
analysis: false,
|
||||||
|
analysis_catalog: false,
|
||||||
tile: false,
|
tile: false,
|
||||||
attributes: false,
|
attributes: false,
|
||||||
named_list: false,
|
named_list: false,
|
||||||
|
@ -356,6 +356,7 @@ var config = {
|
|||||||
dataview: false,
|
dataview: false,
|
||||||
dataview_search: false,
|
dataview_search: false,
|
||||||
analysis: false,
|
analysis: false,
|
||||||
|
analysis_catalog: false,
|
||||||
tile: false,
|
tile: false,
|
||||||
attributes: false,
|
attributes: false,
|
||||||
named_list: false,
|
named_list: false,
|
||||||
|
@ -356,6 +356,7 @@ var config = {
|
|||||||
dataview: false,
|
dataview: false,
|
||||||
dataview_search: false,
|
dataview_search: false,
|
||||||
analysis: false,
|
analysis: false,
|
||||||
|
analysis_catalog: false,
|
||||||
tile: false,
|
tile: false,
|
||||||
attributes: false,
|
attributes: false,
|
||||||
named_list: false,
|
named_list: false,
|
||||||
|
@ -350,6 +350,7 @@ var config = {
|
|||||||
dataview: false,
|
dataview: false,
|
||||||
dataview_search: false,
|
dataview_search: false,
|
||||||
analysis: false,
|
analysis: false,
|
||||||
|
analysis_catalog: false,
|
||||||
tile: false,
|
tile: false,
|
||||||
attributes: false,
|
attributes: false,
|
||||||
named_list: false,
|
named_list: false,
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
var PSQL = require('cartodb-psql');
|
var PSQL = require('cartodb-psql');
|
||||||
var cors = require('../middleware/cors');
|
var cors = require('../middleware/cors');
|
||||||
var userMiddleware = require('../middleware/user');
|
var userMiddleware = require('../middleware/user');
|
||||||
|
const rateLimit = require('../middleware/rate-limit');
|
||||||
|
const { RATE_LIMIT_ENDPOINTS_GROUPS } = rateLimit;
|
||||||
|
|
||||||
function AnalysesController(prepareContext) {
|
function AnalysesController(prepareContext, userLimitsApi) {
|
||||||
this.prepareContext = prepareContext;
|
this.prepareContext = prepareContext;
|
||||||
|
this.userLimitsApi = userLimitsApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = AnalysesController;
|
module.exports = AnalysesController;
|
||||||
@ -14,6 +17,7 @@ AnalysesController.prototype.register = function (app) {
|
|||||||
cors(),
|
cors(),
|
||||||
userMiddleware(),
|
userMiddleware(),
|
||||||
this.prepareContext,
|
this.prepareContext,
|
||||||
|
rateLimit(this.userLimitsApi, RATE_LIMIT_ENDPOINTS_GROUPS.ANALYSIS_CATALOG),
|
||||||
this.createPGClient(),
|
this.createPGClient(),
|
||||||
this.getDataFromQuery({ queryTemplate: catalogQueryTpl, key: 'catalog' }),
|
this.getDataFromQuery({ queryTemplate: catalogQueryTpl, key: 'catalog' }),
|
||||||
this.getDataFromQuery({ queryTemplate: tablesQueryTpl, key: 'tables' }),
|
this.getDataFromQuery({ queryTemplate: tablesQueryTpl, key: 'tables' }),
|
||||||
|
@ -7,6 +7,7 @@ const RATE_LIMIT_ENDPOINTS_GROUPS = {
|
|||||||
DATAVIEW: 'dataview',
|
DATAVIEW: 'dataview',
|
||||||
DATAVIEW_SEARCH: 'dataview_search',
|
DATAVIEW_SEARCH: 'dataview_search',
|
||||||
ANALYSIS: 'analysis',
|
ANALYSIS: 'analysis',
|
||||||
|
ANALYSIS_CATALOG: 'analysis_catalog',
|
||||||
TILE: 'tile',
|
TILE: 'tile',
|
||||||
ATTRIBUTES: 'attributes',
|
ATTRIBUTES: 'attributes',
|
||||||
NAMED_LIST: 'named_list',
|
NAMED_LIST: 'named_list',
|
||||||
|
@ -263,7 +263,7 @@ module.exports = function(serverOptions) {
|
|||||||
|
|
||||||
new controller.NamedMapsAdmin(authApi, templateMaps, userLimitsApi).register(app);
|
new controller.NamedMapsAdmin(authApi, templateMaps, userLimitsApi).register(app);
|
||||||
|
|
||||||
new controller.Analyses(prepareContext).register(app);
|
new controller.Analyses(prepareContext, userLimitsApi).register(app);
|
||||||
|
|
||||||
new controller.ServerInfo(versions).register(app);
|
new controller.ServerInfo(versions).register(app);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user