Add base kubernetes support

This commit is contained in:
Urtzi Alfaro
2025-09-27 11:18:13 +02:00
parent a27f159e24
commit 63a3f9c77a
63 changed files with 5826 additions and 170 deletions

View File

@@ -16,11 +16,23 @@ class DataSettings(BaseServiceSettings):
# API Configuration
API_V1_STR: str = "/api/v1"
# Override database URL to use EXTERNAL_DATABASE_URL
DATABASE_URL: str = Field(
default="postgresql+asyncpg://external_user:external_pass123@external-db:5432/external_db",
env="EXTERNAL_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("EXTERNAL_DATABASE_URL")
if complete_url:
return complete_url
# Build from components (secure approach)
user = os.getenv("EXTERNAL_DB_USER", "external_user")
password = os.getenv("EXTERNAL_DB_PASSWORD", "external_pass123")
host = os.getenv("EXTERNAL_DB_HOST", "localhost")
port = os.getenv("EXTERNAL_DB_PORT", "5432")
name = os.getenv("EXTERNAL_DB_NAME", "external_db")
return f"postgresql+asyncpg://{user}:{password}@{host}:{port}/{name}"
# External API Configuration
AEMET_API_KEY: str = os.getenv("AEMET_API_KEY", "")