diff options
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/rate-limiter.ts | 6 |
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 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import RateLimit, { Options as RateLimitHandlerOptions } from 'express-rate-limit' | 2 | import RateLimit, { Options as RateLimitHandlerOptions } from 'express-rate-limit' |
3 | import { CONFIG } from '@server/initializers/config' | ||
3 | import { RunnerModel } from '@server/models/runner/runner' | 4 | import { RunnerModel } from '@server/models/runner/runner' |
4 | import { UserRole } from '@shared/models' | 5 | import { UserRole } from '@shared/models' |
5 | import { optionalAuthenticate } from './auth' | 6 | import { optionalAuthenticate } from './auth' |
@@ -39,6 +40,11 @@ export function buildRateLimiter (options: { | |||
39 | }) | 40 | }) |
40 | } | 41 | } |
41 | 42 | ||
43 | export 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 | // --------------------------------------------------------------------------- |