feat: allow plugin specific rate limiting
Signed-off-by: Hellgren Heikki <heikki.hellgren@op.fi>
This commit is contained in:
+40
@@ -804,6 +804,11 @@ export interface Config {
|
||||
| {
|
||||
type: 'memory';
|
||||
};
|
||||
/**
|
||||
* Enable/disable global rate limiting. If this is disabled, plugin specific rate limiting must be
|
||||
* used.
|
||||
*/
|
||||
global?: boolean;
|
||||
/**
|
||||
* Time frame in milliseconds or as human duration for which requests are checked/remembered.
|
||||
* Defaults to one minute.
|
||||
@@ -834,6 +839,41 @@ export interface Config {
|
||||
* Defaults to false.
|
||||
*/
|
||||
skipFailedRequests?: boolean;
|
||||
/** Plugin specific rate limiting configuration */
|
||||
plugin?: {
|
||||
[pluginId: string]: {
|
||||
/**
|
||||
* Time frame in milliseconds or as human duration for which requests are checked/remembered.
|
||||
* Defaults to one minute.
|
||||
*/
|
||||
window?: string | HumanDuration;
|
||||
/**
|
||||
* The maximum number of connections to allow during the `window` before rate limiting the client.
|
||||
* Defaults to 5.
|
||||
*/
|
||||
incomingRequestLimit?: number;
|
||||
/**
|
||||
* Whether to pass requests in case of store failure.
|
||||
* Defaults to false.
|
||||
*/
|
||||
passOnStoreError?: boolean;
|
||||
/**
|
||||
* List of allowed IP addresses that are not rate limited.
|
||||
* Defaults to [127.0.0.1, 0:0:0:0:0:0:0:1, ::1].
|
||||
*/
|
||||
ipAllowList?: string[];
|
||||
/**
|
||||
* Skip rate limiting for requests that have been successful.
|
||||
* Defaults to false.
|
||||
*/
|
||||
skipSuccessfulRequests?: boolean;
|
||||
/**
|
||||
* Skip rate limiting for requests that have failed.
|
||||
* Defaults to false.
|
||||
*/
|
||||
skipFailedRequests?: boolean;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user