Add base kubernetes support
This commit is contained in:
@@ -19,9 +19,23 @@ class ForecastingSettings(BaseServiceSettings):
|
||||
SERVICE_NAME: str = "forecasting-service"
|
||||
DESCRIPTION: str = "Demand prediction and forecasting service"
|
||||
|
||||
# Database Configuration
|
||||
DATABASE_URL: str = os.getenv("FORECASTING_DATABASE_URL",
|
||||
"postgresql+asyncpg://forecasting_user:forecasting_pass123@forecasting-db:5432/forecasting_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("FORECASTING_DATABASE_URL")
|
||||
if complete_url:
|
||||
return complete_url
|
||||
|
||||
# Build from components (secure approach)
|
||||
user = os.getenv("FORECASTING_DB_USER", "forecasting_user")
|
||||
password = os.getenv("FORECASTING_DB_PASSWORD", "forecasting_pass123")
|
||||
host = os.getenv("FORECASTING_DB_HOST", "localhost")
|
||||
port = os.getenv("FORECASTING_DB_PORT", "5432")
|
||||
name = os.getenv("FORECASTING_DB_NAME", "forecasting_db")
|
||||
|
||||
return f"postgresql+asyncpg://{user}:{password}@{host}:{port}/{name}"
|
||||
|
||||
# Redis Database (dedicated for prediction cache)
|
||||
REDIS_DB: int = 2
|
||||
|
||||
Reference in New Issue
Block a user