Centralize rate limiting config

Create shared rateLimitConfig.ts with tiers (strict, moderate, lenient, generous, per-user variants) and update edge functions to import centralized rate limiters. Replace inline rate limiter usage with new config, preserving backward compatibility. Add documentation guide for rate limiting usage.
This commit is contained in:
gpt-engineer-app[bot]
2025-11-10 21:33:08 +00:00
parent bf3da6414a
commit ed6ddbd04b
5 changed files with 495 additions and 38 deletions

View File

@@ -558,5 +558,5 @@ const handler = async (req: Request) => {
}
};
// Apply rate limiting: 10 requests per minute per IP (standard tier)
serve(withRateLimit(handler, rateLimiters.standard, corsHeaders));
// Apply rate limiting: 10 requests per minute per IP (moderate tier for moderation actions)
serve(withRateLimit(handler, rateLimiters.moderate, corsHeaders));