mirror of
https://github.com/pheralb/svgl.git
synced 2025-02-11 09:40:31 +08:00
✨ Initial redis server.
This commit is contained in:
parent
4f3a9d133e
commit
bc23448701
14
src/server/redis.ts
Normal file
14
src/server/redis.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { Redis } from '@upstash/redis';
|
||||
import { Ratelimit } from '@upstash/ratelimit';
|
||||
import { UPSTASH_REDIS_TOKEN, UPSTASH_REDIS_URL, SVGL_API_REQUESTS } from '$env/static/private';
|
||||
|
||||
const redis = new Redis({
|
||||
url: UPSTASH_REDIS_URL,
|
||||
token: UPSTASH_REDIS_TOKEN
|
||||
});
|
||||
|
||||
export const ratelimit = new Ratelimit({
|
||||
redis: redis,
|
||||
limiter: Ratelimit.slidingWindow(Number(SVGL_API_REQUESTS), '60s'),
|
||||
analytics: true
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user