Add base kubernetes support
This commit is contained in:
@@ -19,9 +19,23 @@ class NotificationSettings(BaseServiceSettings):
|
||||
SERVICE_NAME: str = "notification-service"
|
||||
DESCRIPTION: str = "Email and WhatsApp notification service"
|
||||
|
||||
# Database Configuration
|
||||
DATABASE_URL: str = os.getenv("NOTIFICATION_DATABASE_URL",
|
||||
"postgresql+asyncpg://notification_user:notification_pass123@notification-db:5432/notification_db")
|
||||
# Database configuration (secure approach - build from components)
|
||||
@property
|
||||
def DATABASE_URL(self) -> str:
|
||||
"""Build database URL from secure components"""
|
||||
# Try complete URL first (for backward compatibility)
|
||||
complete_url = os.getenv("NOTIFICATION_DATABASE_URL")
|
||||
if complete_url:
|
||||
return complete_url
|
||||
|
||||
# Build from components (secure approach)
|
||||
user = os.getenv("NOTIFICATION_DB_USER", "notification_user")
|
||||
password = os.getenv("NOTIFICATION_DB_PASSWORD", "notification_pass123")
|
||||
host = os.getenv("NOTIFICATION_DB_HOST", "localhost")
|
||||
port = os.getenv("NOTIFICATION_DB_PORT", "5432")
|
||||
name = os.getenv("NOTIFICATION_DB_NAME", "notification_db")
|
||||
|
||||
return f"postgresql+asyncpg://{user}:{password}@{host}:{port}/{name}"
|
||||
|
||||
# Redis Database (dedicated for notification queue)
|
||||
REDIS_DB: int = 5
|
||||
|
||||
Reference in New Issue
Block a user