diff --git a/app/server.js b/app/server.js index d80fd596..93ff95dc 100644 --- a/app/server.js +++ b/app/server.js @@ -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 diff --git a/app/services/user_limits.js b/app/services/user_limits.js index 698bea7f..837e7e83 100644 --- a/app/services/user_limits.js +++ b/app/services/user_limits.js @@ -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();