TDD: 1, Me: 0

This commit is contained in:
2024-12-13 18:08:44 +02:00
commit 9c1cfa7c23
36 changed files with 2374 additions and 0 deletions

14
app/redis_config.py Normal file
View File

@@ -0,0 +1,14 @@
from redis import from_url, ConnectionPool, Redis
# Set up Redis connection for Flask-Limiter
def setup_redis(app):
try:
pool = ConnectionPool.from_url(app.config['REDIS_URL'])
redis_connection = Redis(connection_pool=pool)
redis_connection.ping()
app.logger.info("Connected to Redis")
# Return the redis_connection to be used elsewhere
return redis_connection
except Exception as e:
app.logger.error(f"Failed to connect to Redis: {str(e)}")
return None