mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-25 08:32:11 +03:00
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:
@@ -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}`;
|
||||
|
||||
Reference in New Issue
Block a user