added redis config to deployment

This commit is contained in:
rykuno 2024-06-26 17:03:54 -05:00
parent 8fb7a0ea9d
commit 6514c99e05
3 changed files with 9 additions and 3 deletions

View file

@ -2,3 +2,4 @@ ORIGIN=http://localhost:5173
# Database
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
REDIS_URL=redis://localhost:6379

View file

@ -11,7 +11,11 @@ services:
envVars:
- key: DATABASE_URL
fromDatabase:
name: postgres
name: db
property: connectionString
- key: REDIS_URL
fromDatabase:
name: redis
property: connectionString
- key: PUBLIC_ORIGIN
fromDatabase:
@ -22,6 +26,6 @@ services:
ipAllowList: [] # Only allow internal connections
databases:
- name: postgres
- name: db
databaseName: postgres
ipAllowList: []

View file

@ -2,8 +2,9 @@ import { rateLimiter } from "hono-rate-limiter";
import { RedisStore } from 'rate-limit-redis'
import RedisClient from 'ioredis'
import type { HonoTypes } from "../types";
import { config } from "../common/config";
const client = new RedisClient()
const client = new RedisClient(config.REDIS_URL)
export function limiter({ limit, minutes, key = "" }: {
limit: number;