Add connection rate limiting to collaboration server

This commit is contained in:
Tom Moor
2023-06-25 22:46:07 -04:00
parent 453bbb3b25
commit 94882d4d3a
4 changed files with 26 additions and 1 deletions

View File

@@ -540,6 +540,16 @@ export class Environment {
public RATE_LIMITER_REQUESTS =
this.toOptionalNumber(process.env.RATE_LIMITER_REQUESTS) ?? 1000;
/**
* Set max allowed realtime connections in a minute before throttling. Defaults
* to 50 requests/ip/min.
*/
@IsOptional()
@IsNumber()
public RATE_LIMITER_COLLABORATION_REQUESTS =
this.toOptionalNumber(process.env.RATE_LIMITER_COLLABORATION_REQUESTS) ??
50;
/**
* Set fixed duration window(in secs) for default rate limiter, elapsing which
* the request quota is reset (the bucket is refilled with tokens).