Add base kubernetes support
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
Sales Service Configuration
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import List
|
||||
from pydantic import Field
|
||||
from shared.config.base import BaseServiceSettings
|
||||
@@ -20,11 +21,23 @@ class Settings(BaseServiceSettings):
|
||||
# API Configuration
|
||||
API_V1_STR: str = "/api/v1"
|
||||
|
||||
# Override database URL to use SALES_DATABASE_URL
|
||||
DATABASE_URL: str = Field(
|
||||
default="postgresql+asyncpg://sales_user:sales_pass123@sales-db:5432/sales_db",
|
||||
env="SALES_DATABASE_URL"
|
||||
)
|
||||
# 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("SALES_DATABASE_URL")
|
||||
if complete_url:
|
||||
return complete_url
|
||||
|
||||
# Build from components (secure approach)
|
||||
user = os.getenv("SALES_DB_USER", "sales_user")
|
||||
password = os.getenv("SALES_DB_PASSWORD", "sales_pass123")
|
||||
host = os.getenv("SALES_DB_HOST", "localhost")
|
||||
port = os.getenv("SALES_DB_PORT", "5432")
|
||||
name = os.getenv("SALES_DB_NAME", "sales_db")
|
||||
|
||||
return f"postgresql+asyncpg://{user}:{password}@{host}:{port}/{name}"
|
||||
|
||||
# Sales-specific Redis database
|
||||
REDIS_DB: int = Field(default=2, env="SALES_REDIS_DB")
|
||||
|
||||
Reference in New Issue
Block a user