mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-29 20:19:28 +02:00
feat: add config for rate_limit
This commit is contained in:
@@ -29,6 +29,7 @@ interface Config {
|
|||||||
S3_REGION?: string;
|
S3_REGION?: string;
|
||||||
STORAGE: "filesystem" | "s3";
|
STORAGE: "filesystem" | "s3";
|
||||||
TRUST_PROXY: number;
|
TRUST_PROXY: number;
|
||||||
|
RATE_LIMIT: number;
|
||||||
}
|
}
|
||||||
const config: Config = {
|
const config: Config = {
|
||||||
CLIENT_ID: "CLIENT_ID",
|
CLIENT_ID: "CLIENT_ID",
|
||||||
@@ -42,6 +43,7 @@ const config: Config = {
|
|||||||
ANONYMIZATION_MASK: "XXXX",
|
ANONYMIZATION_MASK: "XXXX",
|
||||||
PORT: 5000,
|
PORT: 5000,
|
||||||
TRUST_PROXY: 1,
|
TRUST_PROXY: 1,
|
||||||
|
RATE_LIMIT: 350,
|
||||||
HOSTNAME: "anonymous.4open.science",
|
HOSTNAME: "anonymous.4open.science",
|
||||||
DB_USERNAME: "admin",
|
DB_USERNAME: "admin",
|
||||||
DB_PASSWORD: "password",
|
DB_PASSWORD: "password",
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ export default async function start() {
|
|||||||
sendCommand: (...args: string[]) => redisClient.sendCommand(args),
|
sendCommand: (...args: string[]) => redisClient.sendCommand(args),
|
||||||
}),
|
}),
|
||||||
windowMs: 15 * 60 * 1000, // 15 minutes
|
windowMs: 15 * 60 * 1000, // 15 minutes
|
||||||
max: 1000, // limit each IP
|
max: config.RATE_LIMIT, // limit each IP
|
||||||
standardHeaders: true,
|
standardHeaders: true,
|
||||||
legacyHeaders: false,
|
legacyHeaders: false,
|
||||||
// delayMs: 0, // disable delaying - full speed until the max limit is reached
|
// delayMs: 0, // disable delaying - full speed until the max limit is reached
|
||||||
|
|||||||
Reference in New Issue
Block a user