fix: get branch full working
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
import type { MiddlewareHandler } from 'hono';
|
||||
import { rateLimiter } from '@api/utils/redis/limiter';
|
||||
import { userKeyGenerator } from '../utils/redis/key-generators';
|
||||
import { env } from '@api/config/env';
|
||||
|
||||
export interface RateLimiterOptions {
|
||||
windowMs?: number;
|
||||
@@ -29,7 +30,13 @@ export const createRateLimiter = (options: RateLimiterOptions = {}): MiddlewareH
|
||||
const opts = { ...defaultOptions, ...options };
|
||||
|
||||
return async (c, next) => {
|
||||
// Skip rate limiting if not in production
|
||||
if (env.NODE_ENV !== 'production') {
|
||||
return await next();
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
// Generate rate limit key
|
||||
const key = opts.keyGenerator(c);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user