Add base kubernetes support
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
POS Integration Service Configuration
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import List, Optional
|
||||
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 POS_DATABASE_URL
|
||||
DATABASE_URL: str = Field(
|
||||
default="postgresql+asyncpg://pos_user:pos_pass123@pos-db:5432/pos_db",
|
||||
env="POS_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("POS_DATABASE_URL")
|
||||
if complete_url:
|
||||
return complete_url
|
||||
|
||||
# Build from components (secure approach)
|
||||
user = os.getenv("POS_DB_USER", "pos_user")
|
||||
password = os.getenv("POS_DB_PASSWORD", "pos_pass123")
|
||||
host = os.getenv("POS_DB_HOST", "localhost")
|
||||
port = os.getenv("POS_DB_PORT", "5432")
|
||||
name = os.getenv("POS_DB_NAME", "pos_db")
|
||||
|
||||
return f"postgresql+asyncpg://{user}:{password}@{host}:{port}/{name}"
|
||||
|
||||
# POS-specific Redis database
|
||||
REDIS_DB: int = Field(default=5, env="POS_REDIS_DB")
|
||||
|
||||
Reference in New Issue
Block a user