default rate limits params to server.js
This commit is contained in:
parent
d70013b0f4
commit
60b48df4d6
@ -66,6 +66,19 @@ function App(statsClient) {
|
||||
// Set default configuration
|
||||
global.settings.db_pubuser = global.settings.db_pubuser || "publicuser";
|
||||
global.settings.bufferedRows = global.settings.bufferedRows || 1000;
|
||||
global.settings.ratelimits = Object.assign(
|
||||
{
|
||||
rateLimitsEnabled: false,
|
||||
endpoints: {
|
||||
query: false,
|
||||
query_format: false,
|
||||
job_create: false,
|
||||
job_get: false,
|
||||
job_delete: false
|
||||
}
|
||||
},
|
||||
global.settings.ratelimits
|
||||
);
|
||||
|
||||
var tableCache = new TableCacheFactory().build(global.settings);
|
||||
|
||||
@ -137,7 +150,6 @@ function App(statsClient) {
|
||||
|
||||
var userDatabaseService = new UserDatabaseService(metadataBackend);
|
||||
|
||||
UserLimitsService.configure();
|
||||
const userLimitsServiceOptions = {
|
||||
limits: {
|
||||
rateLimitsEnabled: global.settings.ratelimits.rateLimitsEnabled
|
||||
|
@ -1,14 +1,3 @@
|
||||
const DEFAULT_RATE_LIMITS_OPTIONS = {
|
||||
rateLimitsEnabled: false,
|
||||
endpoints: {
|
||||
query: false,
|
||||
query_format: false,
|
||||
job_create: false,
|
||||
job_get: false,
|
||||
job_delete: false
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* UserLimits
|
||||
* @param {cartodb-redis} metadataBackend
|
||||
@ -22,11 +11,6 @@ class UserLimits {
|
||||
this.preprareRateLimit();
|
||||
}
|
||||
|
||||
static configure() {
|
||||
// default rate limits
|
||||
global.settings.ratelimits = Object.assign({}, DEFAULT_RATE_LIMITS_OPTIONS, global.settings.ratelimits);
|
||||
}
|
||||
|
||||
preprareRateLimit() {
|
||||
if (this.options.limits.rateLimitsEnabled) {
|
||||
this.metadataBackend.loadRateLimitsScript();
|
||||
|
Loading…
Reference in New Issue
Block a user