MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / buildRateLimit

Function buildRateLimit

apps/api/src/config/security/security.ts:108–118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

106
107/**
108 * Per-IP rate limit. Storage is in-memory by default and Valkey-backed
109 * when the cache provider is set to Valkey (see
110 * `buildRateLimitContext`).
111 *
112 * In BoringStack's default deployment, Traefik also rate-limits at the
113 * edge (see `infra/compose/compose/docker-compose.production-labels.yml`).
114 * This app-level limit is the second line of defence.
115 */
116export const buildRateLimit = () => {
117 const context = buildRateLimitContext("general");
118 const generator = buildKeyGenerator();
119
120 return rateLimit({
121 max: env.RATE_LIMIT_MAX,

Callers 1

createAppFunction · 0.90

Calls 2

buildRateLimitContextFunction · 0.85
buildKeyGeneratorFunction · 0.85

Tested by

no test coverage detected