feat(redis): add configurable key namespace prefix (#11042)

Validated on the combined board over tip 80d931ae: quota-redis-store (incl. the KEY_PREFIX derivation test), local-redis-status and rate-limiter-redis-optional green, typecheck:core clean. One pre-merge fix pushed to the branch: docs/reference/ENVIRONMENT.md gained the REDIS_KEY_PREFIX row (env-doc-sync gate requires every .env.example var documented). Board note: the redis tests leave an ioredis retry handle open and hang the runner exit locally — assertions all pass; pre-existing pattern, not from this PR. Thank you @MeRezaRezaei!
This commit is contained in:
Reza Rezaei
2026-08-22 23:56:45 +02:00
committed by GitHub
parent e15af18d17
commit 7360ca4242
9 changed files with 145 additions and 13 deletions

View File

@@ -72,7 +72,7 @@ export function resetRedisClient(): void {
// Key helpers
// ---------------------------------------------------------------------------
const KEY_PREFIX = "omniroute:quota";
const KEY_PREFIX = `${process.env.REDIS_KEY_PREFIX?.trim() || "omniroute:"}quota`;
function bucketKey(apiKeyId: string, dimensionKey: string, bucketIndex: number): string {
return `${KEY_PREFIX}:${apiKeyId}:${dimensionKey}:${bucketIndex}`;