fix: use const & specify which config was invaldi

pull/242/head
Josh Moore 1 year ago
parent 3709a6958e
commit 304f499cac

@ -112,9 +112,9 @@ export class UserConfig {
// * optional rate limit config // * optional rate limit config
if (config.rateLimit != null) { if (config.rateLimit != null) {
if (!Checkers.rateLimit.endpoint(config.rateLimit.login)) throw new Error('Invalid rate limit configuration'); if (!Checkers.rateLimit.endpoint(config.rateLimit.login)) throw new Error('Invalid Login rate limit configuration');
if (!Checkers.rateLimit.endpoint(config.rateLimit.upload)) throw new Error('Invalid rate limit configuration'); if (!Checkers.rateLimit.endpoint(config.rateLimit.upload)) throw new Error('Invalid Upload rate limit configuration');
if (!Checkers.rateLimit.endpoint(config.rateLimit.api)) throw new Error('Invalid rate limit configuration'); if (!Checkers.rateLimit.endpoint(config.rateLimit.api)) throw new Error('Invalid API rate limit configuration');
} }
// All is fine, carry on! // All is fine, carry on!

@ -5,7 +5,7 @@ import { rateLimit } from 'express-rate-limit';
/** /**
* map that contains rate limiter middleware for each group * map that contains rate limiter middleware for each group
*/ */
let rateLimiterGroups = new Map<string, (req: Request, res: Response, next: NextFunction) => void>(); const rateLimiterGroups = new Map<string, (req: Request, res: Response, next: NextFunction) => void>();
/** /**
* creates middleware for rate limiting * creates middleware for rate limiting

Loading…
Cancel
Save