Only use rate limiter if rate_limit enabled set to true

This commit is contained in:
Tanya Byrne
2020-08-25 20:21:06 +01:00
parent 7f1b29ed08
commit c8f771c807
2 changed files with 7 additions and 4 deletions

View File

@@ -68,7 +68,9 @@ if (env.NODE_ENV !== 'development') {
}
// use the rate limiter - all routes for now
app.use(rateLimiter);
if (env.RATE_LIMIT_ENABLED === 'true') {
app.use(rateLimiter);
}
app.use('/auth', authRouter)
.use(authenticate)

View File

@@ -26,9 +26,10 @@ const defaults = {
STORAGE_LOCAL_ROOT: './uploads',
},
rateLimits: {
REDIS_HOST: '127.0.0.1',
REDIS_PORT: '6379',
REDIS_PASSWORD: null,
RATE_LIMIT_ENABLED: true,
SREDIS_HOST: '127.0.0.1',
SREDIS_PORT: '6379',
SREDIS_PASSWORD: null,
RATE_LIMIT_TYPE: 'redis',
CONSUMED_POINTS_LIMIT: 5,
CONSUMED_RESET_DURATION: 1,