()
| 106 | * This app-level limit is the second line of defence. |
| 107 | */ |
| 108 | export const buildRateLimit = () => { |
| 109 | const context = buildRateLimitContext(); |
| 110 | const generator = buildKeyGenerator(); |
| 111 | |
| 112 | return rateLimit({ |
| 113 | max: env.RATE_LIMIT_MAX, |
| 114 | duration: env.RATE_LIMIT_WINDOW_MS, |
| 115 | ...(context !== undefined && { context }), |
| 116 | ...(generator !== undefined && { generator }), |
| 117 | }); |
| 118 | }; |
| 119 | |
| 120 | export const buildAuthRateLimit = () => { |
| 121 | const context = buildRateLimitContext(); |
no test coverage detected