aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/rate-limiter.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/server/middlewares/rate-limiter.ts b/server/middlewares/rate-limiter.ts
index 0e936028c..8257965dd 100644
--- a/server/middlewares/rate-limiter.ts
+++ b/server/middlewares/rate-limiter.ts
@@ -1,5 +1,6 @@
1import express from 'express' 1import express from 'express'
2import RateLimit, { Options as RateLimitHandlerOptions } from 'express-rate-limit' 2import RateLimit, { Options as RateLimitHandlerOptions } from 'express-rate-limit'
3import { CONFIG } from '@server/initializers/config'
3import { RunnerModel } from '@server/models/runner/runner' 4import { RunnerModel } from '@server/models/runner/runner'
4import { UserRole } from '@shared/models' 5import { UserRole } from '@shared/models'
5import { optionalAuthenticate } from './auth' 6import { optionalAuthenticate } from './auth'
@@ -39,6 +40,11 @@ export function buildRateLimiter (options: {
39 }) 40 })
40} 41}
41 42
43export const apiRateLimiter = buildRateLimiter({
44 windowMs: CONFIG.RATES_LIMIT.API.WINDOW_MS,
45 max: CONFIG.RATES_LIMIT.API.MAX
46})
47
42// --------------------------------------------------------------------------- 48// ---------------------------------------------------------------------------
43// Private 49// Private
44// --------------------------------------------------------------------------- 50// ---------------------------------------------------------------------------