added redis authenticaiton

This commit is contained in:
2025-02-06 15:32:04 +00:00
parent 826d9573d8
commit 2a47e00255
2 changed files with 6 additions and 4 deletions

View File

@@ -16,10 +16,11 @@ app = FastAPI()
# Secret API Key
SECRET_PHRASE = os.getenv("API_SECRET", "my_secret_key")
# Redis for Rate Limiting
REDIS_URL = os.getenv("REDIS_URL", "redis://localhost:6379")
# Use the Redis password from the environment variable
REDIS_URL = os.getenv("REDIS_URL", "redis://:my_redis_password@redis:6379")
redis_client = redis.from_url(REDIS_URL)
@app.on_event("startup")
async def startup():
"""Initialize FastAPI Limiter."""