Spaces:
Sleeping
Sleeping
Commit ·
1f3f77e
1
Parent(s): ff7b037
feat(redis): Add Redis username configuration for enhanced security
Browse files- .env.example +1 -0
- app/cache.py +1 -0
- app/core/config.py +1 -0
.env.example
CHANGED
|
@@ -28,6 +28,7 @@ DATABASE_URL=postgresql+asyncpg://your-db-user:your-db-password@localhost:5432/c
|
|
| 28 |
# Redis Configuration (for caching and session management)
|
| 29 |
REDIS_HOST=localhost
|
| 30 |
REDIS_PORT=6379
|
|
|
|
| 31 |
REDIS_PASSWORD=your-redis-password
|
| 32 |
REDIS_DB=0
|
| 33 |
|
|
|
|
| 28 |
# Redis Configuration (for caching and session management)
|
| 29 |
REDIS_HOST=localhost
|
| 30 |
REDIS_PORT=6379
|
| 31 |
+
REDIS_USERNAME=default
|
| 32 |
REDIS_PASSWORD=your-redis-password
|
| 33 |
REDIS_DB=0
|
| 34 |
|
app/cache.py
CHANGED
|
@@ -28,6 +28,7 @@ async def connect_to_redis():
|
|
| 28 |
redis_client = redis.Redis(
|
| 29 |
host=settings.REDIS_HOST,
|
| 30 |
port=settings.REDIS_PORT,
|
|
|
|
| 31 |
password=settings.REDIS_PASSWORD,
|
| 32 |
db=settings.REDIS_DB,
|
| 33 |
decode_responses=True
|
|
|
|
| 28 |
redis_client = redis.Redis(
|
| 29 |
host=settings.REDIS_HOST,
|
| 30 |
port=settings.REDIS_PORT,
|
| 31 |
+
username=settings.REDIS_USERNAME,
|
| 32 |
password=settings.REDIS_PASSWORD,
|
| 33 |
db=settings.REDIS_DB,
|
| 34 |
decode_responses=True
|
app/core/config.py
CHANGED
|
@@ -82,6 +82,7 @@ class Settings(BaseSettings):
|
|
| 82 |
# Redis Configuration
|
| 83 |
REDIS_HOST: str = os.getenv("REDIS_HOST", "localhost")
|
| 84 |
REDIS_PORT: int = int(os.getenv("REDIS_PORT", "6379"))
|
|
|
|
| 85 |
REDIS_PASSWORD: Optional[str] = os.getenv("REDIS_PASSWORD")
|
| 86 |
REDIS_DB: int = int(os.getenv("REDIS_DB", "0"))
|
| 87 |
|
|
|
|
| 82 |
# Redis Configuration
|
| 83 |
REDIS_HOST: str = os.getenv("REDIS_HOST", "localhost")
|
| 84 |
REDIS_PORT: int = int(os.getenv("REDIS_PORT", "6379"))
|
| 85 |
+
REDIS_USERNAME: Optional[str] = os.getenv("REDIS_USERNAME")
|
| 86 |
REDIS_PASSWORD: Optional[str] = os.getenv("REDIS_PASSWORD")
|
| 87 |
REDIS_DB: int = int(os.getenv("REDIS_DB", "0"))
|
| 88 |
|