Skip to content

Commit

Permalink
Refactor main.py to use Redis connection from environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ezeisraeljohn committed Sep 19, 2024
1 parent 101d370 commit 9251ecc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
from db.session import create_all_tables_and_initialize_redis_instance
from pydantic import ValidationError
from starlette.middleware.base import BaseHTTPMiddleware
from redis_db.redis_db import init_redis
from api.v1 import (
account_router,
refunds_router,
payment_method_router,
transaction_router,
)
import os
import redis

REDIS_URL = os.getenv("REDIS_URL")
client = redis.Redis.from_url(REDIS_URL)

app = FastAPI(
lifespan=create_all_tables_and_initialize_redis_instance,
Expand Down

0 comments on commit 9251ecc

Please sign in to comment.