UNPKG

@universis/janitor

Version:

Universis api plugin for handling user authorization and rate limiting

84 lines 2.91 kB
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "id": "urn:universis:rate-limit-service:1", "description": "@universis/janitor#RateLimitService configuration schema", "properties": { "storeType": { "type": "string", "description": "The type of store to use for rate limiting @universis/janitor#RedisClientStore" }, "profiles": { "type": "array", "description": "A named collection of rate limit configurations", "items": [ { "type": "array", "items": [ { "type": "string", "description": "The name of current rate limit profile." }, { "type": "object", "properties": { "windowMs": { "description": "Time frame for which requests are checked/remembered. Also used in the Retry-After header when the limit is reached.", "type": "integer" }, "limit": { "description": "The maximum number of connections to allow during the window before rate limiting the client.", "type": "integer" }, "legacyHeaders": { "description": "Whether to send the legacy rate limit headers for the limit (X-RateLimit-Limit), current usage (X-RateLimit-Remaining) and reset time (if the store provides it) (X-RateLimit-Reset) on all responses.", "type": "boolean" }, "skipFailedRequests": { "description": "When set to true, failed requests won't be counted. Request considered failed when the requestWasSuccessful option returns false.", "type": "boolean" }, "skipSuccessfulRequests": { "description": "If true, the library will (by default) skip all requests that are considered 'failed' by the requestWasSuccessful function.", "type": "boolean" } }, "required": [ "windowMs", "limit" ] } ] } ] }, "paths": { "type": "array", "items": [ { "type": "array", "items": [ { "type": "string" }, { "type": "object", "properties": { "profile": { "type": "string" } }, "required": [ "profile" ] } ] } ] } }, "required": [ "profiles", "paths" ] }