File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -6,14 +6,16 @@ import { createClient } from 'redis';
66import { getRedisUrl } from '@nangohq/shared' ;
77import { flagHasAPIRateLimit , flagHasPlan , getLogger } from '@nangohq/utils' ;
88
9+ import { envs } from '../env.js' ;
10+
911import type { RequestLocals } from '../utils/express.js' ;
1012import type { DBPlan } from '@nangohq/types' ;
1113import type { NextFunction , Request , Response } from 'express' ;
1214import type { RateLimiterAbstract } from 'rate-limiter-flexible' ;
1315
1416const logger = getLogger ( 'RateLimiter' ) ;
1517
16- const defaultLimit = parseInt ( process . env [ ' DEFAULT_RATE_LIMIT_PER_MIN' ] || '0' ) || 3500 ;
18+ const defaultLimit = envs . DEFAULT_RATE_LIMIT_PER_MIN ;
1719const rateLimiterSize : Record < DBPlan [ 'api_rate_limit_size' ] , number > = {
1820 s : defaultLimit / 2 ,
1921 m : defaultLimit ,
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export const ENVS = z.object({
2222 SERVER_PORT : z . coerce . number ( ) . optional ( ) . default ( 3003 ) ,
2323 NANGO_SERVER_URL : z . url ( ) . optional ( ) ,
2424 NANGO_SERVER_KEEP_ALIVE_TIMEOUT : z . coerce . number ( ) . optional ( ) . default ( 61_000 ) ,
25- DEFAULT_RATE_LIMIT_PER_MIN : z . coerce . number ( ) . min ( 1 ) . optional ( ) ,
25+ DEFAULT_RATE_LIMIT_PER_MIN : z . coerce . number ( ) . min ( 1 ) . optional ( ) . default ( 200 ) ,
2626 NANGO_CACHE_ENV_KEYS : z . stringbool ( ) . optional ( ) . default ( false ) ,
2727 NANGO_SERVER_WEBSOCKETS_PATH : z . string ( ) . optional ( ) ,
2828 NANGO_ADMIN_INVITE_TOKEN : z . string ( ) . optional ( ) ,
You can’t perform that action at this time.
0 commit comments