From 4302bd4655298c7254f971f573c483e3fe52e345 Mon Sep 17 00:00:00 2001 From: AlexeerCT Date: Tue, 3 Mar 2026 12:58:00 -0600 Subject: [PATCH] feat: Update environment variables and improve Sitar API configuration --- .env.example | 15 +++++---------- docker-compose.prod.yml | 5 +---- docker-compose.yml | 3 --- frontend/src/routes/auth/callback/+page.server.ts | 2 +- frontend/src/routes/login/+page.server.ts | 2 +- frontend/svelte.config.js | 2 +- 6 files changed, 9 insertions(+), 20 deletions(-) diff --git a/.env.example b/.env.example index 87dcbf5f..46bb47bc 100644 --- a/.env.example +++ b/.env.example @@ -31,16 +31,6 @@ CORE_DB_PASSWORD=postgres # Ejemplo para Hub: http://localhost:5173,http://100.78.6.108:5174,http://100.78.6.108:8001 CORS_ORIGINS=http://localhost:5173,http://localhost:3000 -# ---- API Tipo cambio (External) --- -EXTERNAL_API_URL=http://74.208.80.245:3000 -EXTERNAL_API_USER=devAS -EXTERNAL_API_PASSWORD=T6Y4mqP09Y[-2-3H - -# ----- API SITAR (Warnings) --- -SITAR_API_URL="" -SITAR_API_USER="" -SITAR_API_PASSWORD="" - # ----- Frontend ----- NODE_ENV=development VITE_API_URL=http://localhost:8000/api @@ -52,6 +42,11 @@ VITE_KEYCLOAK_CLIENT_ID=anexo76-frontend #------ Celery / Valkey ---------- VALKEY_URL=redis://valkey:6379/0 +# ----- Sitar API ----- +SITAR_API_URL=http://api.sitar.aduanasoft.com +SITAR_API_USER=user_sitar_api +SITAR_API_PASSWORD=password123 + # ================================== # CONFIGURACIÓN DE SINCRONIZACIÓN # ================================== diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 9b422bfa..2c828760 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -173,10 +173,7 @@ services: - CORS_ORIGINS=${CORS_ORIGINS:-https://anexo76-dev.aduanasoft.com,http://localhost:3000} - SITAR_API_URL=${SITAR_API_URL} - SITAR_API_USER=${SITAR_API_USER} - - SITAR_API_PASSWORD=${SITAR_API_PASSWORD} - - EXTERNAL_API_URL=${EXTERNAL_API_URL} - - EXTERNAL_API_USER=${EXTERNAL_API_USER} - - EXTERNAL_API_PASSWORD=${EXTERNAL_API_PASSWORD} + - SITAR_API_PASSWORD=${SITAR_API_PASSWORD} - VALKEY_URL=${VALKEY_URL:-redis://valkey:6379/0} - CENTRAL_SERVER_URL=${CENTRAL_SERVER_URL:-""} - SYNC_SECRET_TOKEN=${SYNC_SECRET_TOKEN:-change-this-sync-token-in-production} diff --git a/docker-compose.yml b/docker-compose.yml index 5ae2e394..78f78bd3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -178,9 +178,6 @@ services: - SITAR_API_URL=${SITAR_API_URL} - SITAR_API_USER=${SITAR_API_USER} - SITAR_API_PASSWORD=${SITAR_API_PASSWORD} - - EXTERNAL_API_URL=${EXTERNAL_API_URL} - - EXTERNAL_API_USER=${EXTERNAL_API_USER} - - EXTERNAL_API_PASSWORD=${EXTERNAL_API_PASSWORD} - VALKEY_URL=${VALKEY_URL:-redis://valkey:6379/0} - CENTRAL_SERVER_URL=${CENTRAL_SERVER_URL:-""} - SYNC_SECRET_TOKEN=${SYNC_SECRET_TOKEN:-change-this-sync-token-in-production} diff --git a/frontend/src/routes/auth/callback/+page.server.ts b/frontend/src/routes/auth/callback/+page.server.ts index 6e0426d5..5f3372bc 100644 --- a/frontend/src/routes/auth/callback/+page.server.ts +++ b/frontend/src/routes/auth/callback/+page.server.ts @@ -1,7 +1,7 @@ import { redirect } from '@sveltejs/kit'; import type { PageServerLoad } from './$types'; -export const load: PageServerLoad = async ({ url, cookies }) => { +export const load: PageServerLoad = async ({ url, cookies, fetch }) => { // Obtener el código y state de los query params const code = url.searchParams.get('code'); const state = url.searchParams.get('state'); diff --git a/frontend/src/routes/login/+page.server.ts b/frontend/src/routes/login/+page.server.ts index c8492b7a..0fd34e11 100644 --- a/frontend/src/routes/login/+page.server.ts +++ b/frontend/src/routes/login/+page.server.ts @@ -19,7 +19,7 @@ export const load: PageServerLoad = async ({ cookies, url }) => { }; export const actions = { - default: async ({ request, cookies, url }) => { + default: async ({ request, cookies, url, fetch }) => { const data = await request.formData(); const username = data.get('username')?.toString(); const password = data.get('password')?.toString(); diff --git a/frontend/svelte.config.js b/frontend/svelte.config.js index d3ef3f6a..72124dee 100644 --- a/frontend/svelte.config.js +++ b/frontend/svelte.config.js @@ -9,7 +9,7 @@ const config = { kit: { adapter: adapter(), csrf: { - checkOrigin: false + trustedOrigins: (process.env.TRUSTED_ORIGINS ?? process.env.CORS_ORIGINS ?? '').split(',').filter(Boolean) } } };