feat: add basic webui
This commit is contained in:
17
packages/rate-limit/index.ts
Normal file
17
packages/rate-limit/index.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { env } from '@konobangu/env';
|
||||
import { Ratelimit, type RatelimitConfig } from '@upstash/ratelimit';
|
||||
import { Redis } from '@upstash/redis';
|
||||
|
||||
export const redis = new Redis({
|
||||
url: env.UPSTASH_REDIS_REST_URL,
|
||||
token: env.UPSTASH_REDIS_REST_TOKEN,
|
||||
});
|
||||
|
||||
export const createRateLimiter = (props: Omit<RatelimitConfig, 'redis'>) =>
|
||||
new Ratelimit({
|
||||
redis,
|
||||
limiter: props.limiter ?? Ratelimit.slidingWindow(10, '10 s'),
|
||||
prefix: props.prefix ?? 'next-forge',
|
||||
});
|
||||
|
||||
export const { slidingWindow } = Ratelimit;
|
||||
Reference in New Issue
Block a user