added redis authenticaiton
This commit is contained in:
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user