This commit is contained in:
Owen 2025-07-16 18:20:05 -07:00
parent 84c28645be
commit 71bb1105f7
No known key found for this signature in database
GPG key ID: 8271FDFFD9E0CCBD
6 changed files with 2 additions and 610 deletions

View file

@ -1,16 +1,6 @@
import { MemoryStore, Store } from "express-rate-limit";
import config from "./config";
import redisManager from "@server/db/redis";
import { RedisStore } from "rate-limit-redis";
export function createStore(): Store {
let rateLimitStore: Store = new MemoryStore();
if (config.getRawConfig().flags?.enable_redis) {
const client = redisManager.client!;
rateLimitStore = new RedisStore({
sendCommand: async (command: string, ...args: string[]) =>
(await client.call(command, args)) as any
});
}
return rateLimitStore;
}