From 83df3a87fee6ed09db5cda1d55ffefc1734eefde Mon Sep 17 00:00:00 2001 From: David Arranz Date: Fri, 13 Sep 2024 12:58:51 +0200 Subject: [PATCH] . --- Dockerfile.server | 4 ++++ server/src/config/environments/development.ts | 2 +- server/src/config/environments/production.ts | 1 + server/src/infrastructure/express/app.ts | 4 +++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile.server b/Dockerfile.server index 7c9596a..c8046ea 100644 --- a/Dockerfile.server +++ b/Dockerfile.server @@ -26,6 +26,10 @@ RUN cd ./server && yarn install # Si hay un error, mostrarlo en detalle. RUN cd ./server && yarn run build || { echo 'Error during build'; exit 1; } +# Copiar plantillas +RUN mkdir -p /api/dist/server/src/contexts/sales/infrastructure/express/controllers/quotes/reportQuote/reporter/templates/quote/ +COPY server/src/contexts/sales/infrastructure/express/controllers/quotes/reportQuote/reporter/templates/quote/* /api/dist/server/src/contexts/sales/infrastructure/express/controllers/quotes/reportQuote/reporter/templates/quote + # FINAL STAGE (Producción) FROM node:lts-iron AS prod diff --git a/server/src/config/environments/development.ts b/server/src/config/environments/development.ts index f58f23e..262d045 100644 --- a/server/src/config/environments/development.ts +++ b/server/src/config/environments/development.ts @@ -33,7 +33,7 @@ module.exports = { server: { hostname: process.env.HOSTNAME || "127.0.0.1", port: process.env.PORT || 4001, - public_url: "", + cors_origin: "*", }, admin: { diff --git a/server/src/config/environments/production.ts b/server/src/config/environments/production.ts index b5c587e..7e73836 100644 --- a/server/src/config/environments/production.ts +++ b/server/src/config/environments/production.ts @@ -18,6 +18,7 @@ module.exports = { server: { hostname: process.env.HOSTNAME || "127.0.0.1", port: process.env.PORT || 3001, + cors_origin: "https://presupuestos.uecko.com", }, admin: { diff --git a/server/src/infrastructure/express/app.ts b/server/src/infrastructure/express/app.ts index 160e782..69d5fe1 100644 --- a/server/src/infrastructure/express/app.ts +++ b/server/src/infrastructure/express/app.ts @@ -7,6 +7,7 @@ import { configurePassportAuth } from "@/contexts/auth"; import morgan from "morgan"; import passport from "passport"; import path from "path"; +import { config } from "../../config"; import { v1Routes } from "./api/v1"; //const logger = initLogger(rTracer); @@ -26,7 +27,8 @@ app.use(responseTime()); // enable CORS - Cross Origin Resource Sharing app.use( cors({ - origin: "*", //"http://localhost:5173", + origin: config.server.cors_origin, + methods: "GET,POST,PUT,DELETE", credentials: true, exposedHeaders: [