Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*/
const rateLimiterAuthed = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'rate-limiter-authed',
points: 3000, // requests per
duration: 60 // seconds by IP
})
const rateLimiterWhitelisted = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'rate-limiter-whitelist',
points: 60000, // requests per
duration: 60 // seconds by IP
})
const rateLimiter = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'rate-limiter',
points: +process.env.ANON_RATE_LIMIT_PER_M || 60, // requests per
duration: 60 // seconds by IP
})
const noRateLimiter = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'no-rate-limiter',
points: Number.MAX_SAFE_INTEGER, // requests per
duration: 1 // seconds by IP
})
const globalRateLimiter = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'global-limiter',
const rateLimiterWhitelisted = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'rate-limiter-whitelist',
points: 60000, // requests per
duration: 60 // seconds by IP
})
const rateLimiter = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'rate-limiter',
points: +process.env.ANON_RATE_LIMIT_PER_M || 60, // requests per
duration: 60 // seconds by IP
})
const noRateLimiter = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'no-rate-limiter',
points: Number.MAX_SAFE_INTEGER, // requests per
duration: 1 // seconds by IP
})
const globalRateLimiter = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'global-limiter',
points: +process.env.GLOBAL_RATE_LIMIT_PER_10S || 10000, // requests per
duration: 10 // seconds
})
const internals = {
pluginName,
redisClient,
module.exports = (runtime) => {
const redisClient = (runtime.cache && runtime.cache.cache) || runtime.queue.config.client
/* access type requests/minute per IP address
------------------- ------------------------------
anonymous (browser) 60
administrator (github) 3000
server (bearer token) 60000
*/
const rateLimiterAuthed = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'rate-limiter-authed',
points: 3000, // requests per
duration: 60 // seconds by IP
})
const rateLimiterWhitelisted = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'rate-limiter-whitelist',
points: 60000, // requests per
duration: 60 // seconds by IP
})
const rateLimiter = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'rate-limiter',
const redisClient = (runtime.cache && runtime.cache.cache) || runtime.queue.config.client
/* access type requests/minute per IP address
------------------- ------------------------------
anonymous (browser) 60
administrator (github) 3000
server (bearer token) 60000
*/
const rateLimiterAuthed = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'rate-limiter-authed',
points: 3000, // requests per
duration: 60 // seconds by IP
})
const rateLimiterWhitelisted = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'rate-limiter-whitelist',
points: 60000, // requests per
duration: 60 // seconds by IP
})
const rateLimiter = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'rate-limiter',
points: +process.env.ANON_RATE_LIMIT_PER_M || 60, // requests per
duration: 60 // seconds by IP
})
const noRateLimiter = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'no-rate-limiter',
const rateLimiter = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'rate-limiter',
points: +process.env.ANON_RATE_LIMIT_PER_M || 60, // requests per
duration: 60 // seconds by IP
})
const noRateLimiter = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'no-rate-limiter',
points: Number.MAX_SAFE_INTEGER, // requests per
duration: 1 // seconds by IP
})
const globalRateLimiter = new RateLimiterRedis({
redis: redisClient,
keyPrefix: 'global-limiter',
points: +process.env.GLOBAL_RATE_LIMIT_PER_10S || 10000, // requests per
duration: 10 // seconds
})
const internals = {
pluginName,
redisClient,
rateLimiter,
rateLimiterAuthed,
rateLimiterWhitelisted,
noRateLimiter
}
return {