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
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
REDIS_URL=redis://localhost:6379

View file

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

View file

@ -2,8 +2,9 @@ import { rateLimiter } from "hono-rate-limiter";
import { RedisStore } from 'rate-limit-redis' import { RedisStore } from 'rate-limit-redis'
import RedisClient from 'ioredis' import RedisClient from 'ioredis'
import type { HonoTypes } from "../types"; 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 = "" }: { export function limiter({ limit, minutes, key = "" }: {
limit: number; limit: number;