feat: sincronizar scaffold completo del shape web-backend/python
Sincroniza el scaffold canónico desde templates/web-backend-python/ del repo IDP. Reemplaza el placeholder mínimo previo (.gitea/workflows/ci.yaml, README.md, .gitignore, catalog-info.yaml) por el scaffold completo documentado en ADR-053 §3: - code/ — FastAPI app con /health (db check), /metrics, /demo estático, middleware correlation_id, settings Pydantic, db.py con SQLAlchemy - code/alembic/ — migración inicial vacía + env.py usando MIGRATION_DATABASE_URL - code/tests/ — pytest + httpx TestClient (test_health, test_demo) - helm/APP_NAME/ — chart con Deployment, Service, IngressRoute Traefik, NetworkPolicy, ServiceMonitor, Job alembic-upgrade como hook pre-upgrade,pre-install (backoffLimit: 0) - coralware-shape.yaml — manifiesto v1alpha1 del contrato del shape - claim-mariadb.yaml — AddonClaim declarativo (uso futuro ADR-052) - catalog-info.yaml — entidad Backstage actualizada - .gitea/workflows/APP_NAME-build.yaml — invoca reusable workflow ADR-038 + job helm-deploy con KUBECONFIG_TENANT_B64 Placeholders __APP_NAME__, __TIER__, __TENANT_ID__, __TENANT_ID_NODASHES__ serán sustituidos server-side por repo-provisioner cuando materialice el template para un tenant (pendiente — ADR-053 §11.5). El openspec/ del golden path NO se sincroniza al repo Gitea (gobernanza interna de Coralware). Refs: ADR-052, ADR-053, poc-nexobms.md (PoC NexoBMS Demetrio).
This commit is contained in:
32
code/app/settings.py
Normal file
32
code/app/settings.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
Configuración runtime via variables de entorno.
|
||||
Toda la configuración pasa por aquí — no leas env vars dispersos en otros módulos.
|
||||
"""
|
||||
|
||||
from pydantic import Field
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
model_config = SettingsConfigDict(env_file=None, case_sensitive=True)
|
||||
|
||||
DATABASE_URL: str = Field(..., description="Connection string runtime de la app")
|
||||
MIGRATION_DATABASE_URL: str = Field(
|
||||
default="",
|
||||
description="Connection string para Alembic; si vacío, usa DATABASE_URL",
|
||||
)
|
||||
|
||||
LOG_LEVEL: str = "INFO"
|
||||
CORRELATION_ID_HEADER: str = "X-Correlation-ID"
|
||||
|
||||
OPENAPI_REQUIRE_AUTH: bool = False
|
||||
KEYCLOAK_ISSUER: str = ""
|
||||
|
||||
STATIC_DEMO_PATH: str = "/app/static/demo"
|
||||
|
||||
@property
|
||||
def migration_url(self) -> str:
|
||||
return self.MIGRATION_DATABASE_URL or self.DATABASE_URL
|
||||
|
||||
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user