From f03ac38c4f599e5284f12fc4c27f5a308e98189a Mon Sep 17 00:00:00 2001 From: Aduanasoft Date: Thu, 16 Jul 2026 08:55:28 -0600 Subject: [PATCH] =?UTF-8?q?docs(deploy):=20env=20de=20testing=20con=20auth?= =?UTF-8?q?=20real=20v=C3=ADa=20Hub=20(SSO=20relay,=20realm=20master,=20cl?= =?UTF-8?q?ient=20aduanasoft)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrige la receta de integración según el código del Hub: single-realm (master) + single-client (aduanasoft), HUB_URL para el sso-exchange del relay, y URLs del dominio del CRM. Secretos en blanco (los pone el operador en el server). Co-Authored-By: Claude Opus 4.8 (1M context) --- deploy/env.testing.example | 63 +++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/deploy/env.testing.example b/deploy/env.testing.example index 006d666..f7673b2 100644 --- a/deploy/env.testing.example +++ b/deploy/env.testing.example @@ -1,47 +1,48 @@ # ========================================================================== -# Plantilla de entorno para testing.crm.aduanasoft.com (entorno de PRUEBAS) -# Copia este archivo como `.env` EN EL SERVIDOR y rellena los valores reales. -# NO subas el .env con secretos al repositorio. +# testing.crm.aduanasoft.com — AUTH REAL vía Hub (SSO relay). Copia como `.env` +# EN EL SERVIDOR y rellena los <...>. NO subas el .env con secretos al repo. +# +# Flujo: el Hub (App Launcher) redirige a /auth/sso?relay=; el CRM +# intercambia el relay en POST {HUB_URL}/api/v1/auth/sso-exchange y entra. # ========================================================================== -# ---- SEGURIDAD (CRÍTICO) ---- -# Debe ser 'production'. NUNCA 'development' en un dominio público: el RBAC -# hace auto-bootstrap de super_admin al usuario en 'development' (cualquiera -# quedaría como administrador total). +# ---- SEGURIDAD ---- ENVIRONMENT=production -# NUNCA 'true' en público: activa el login local "Entrar como dev" y salta Keycloak. DEV_LOCAL_AUTH=false -# Genera uno fuerte: openssl rand -hex 32 -SECRET_KEY=CHANGE_ME_openssl_rand_hex_32 +SECRET_KEY= -# ---- Autenticación (Keycloak / Hub) ---- -HUB_URL=https://CHANGE_ME_hub_o_keycloak/ -# (agrega aquí los claims/realm/cliente que use tu integración real) +# ---- Workspace / Hub (DEBE ser el MISMO Hub que generó el relay) ---- +# Confirmar el host real de producción (workspace.aduanasoft.com o hub.aduanasoft.com): +WORKSPACE_URL=https:// +HUB_URL=https:// +INTERNAL_HUB_URL=https:// +VITE_HUB_URL=https:// + +# ---- Keycloak (arquitectura single-realm / single-client) ---- +KEYCLOAK_URL=https:///kcauth +VITE_KEYCLOAK_URL=https:///kcauth +KEYCLOAK_REALM=master +KEYCLOAK_CLIENT_ID=aduanasoft +KEYCLOAK_CLIENT_SECRET= + +# ---- Dominio del CRM (mismo origen app + API vía nginx) ---- +ORIGIN=https://testing.crm.aduanasoft.com +APP_PUBLIC_URL=https://testing.crm.aduanasoft.com +VITE_API_URL=https://testing.crm.aduanasoft.com/api/ +INTERNAL_API_URL=http://backend:8000/api/ +CORS_ORIGINS=https://testing.crm.aduanasoft.com # ---- Base de datos (PostgreSQL) ---- CORE_DB_HOST=postgres CORE_DB_PORT=5432 CORE_DB_NAME=crm_core -CORE_DB_USER=CHANGE_ME -CORE_DB_PASSWORD=CHANGE_ME +CORE_DB_USER= +POSTGRES_APP_PASSWORD= -# ---- Almacenamiento de objetos (MinIO / S3) ---- +# ---- MinIO / S3 ---- S3_ENDPOINT_URL=http://minio:9000 -S3_ACCESS_KEY=CHANGE_ME -S3_SECRET_KEY=CHANGE_ME +S3_ACCESS_KEY= +S3_SECRET_KEY= S3_BUCKET=crm S3_REGION=us-east-1 S3_USE_SSL=false - -# ---- URLs públicas / CORS (mismo origen que nginx) ---- -APP_PUBLIC_URL=https://testing.crm.aduanasoft.com -CORS_ORIGINS=https://testing.crm.aduanasoft.com - -# ---- Frontend (SvelteKit adapter-node) ---- -# API en el mismo origen a través de nginx (/api/): -VITE_API_URL=https://testing.crm.aduanasoft.com/api/ -# Llamadas servidor->servidor dentro de la red de Docker: -BACKEND_URL=http://backend:8000 -INTERNAL_API_URL=http://backend:8000/api/ -# adapter-node valida el Origin contra ORIGIN; debe ser la URL pública: -ORIGIN=https://testing.crm.aduanasoft.com