diff --git a/backend/src/core/config/index.ts b/backend/src/core/config/index.ts index fcc6e0f..8c0e0a6 100644 --- a/backend/src/core/config/index.ts +++ b/backend/src/core/config/index.ts @@ -3,6 +3,7 @@ import * as dotenv from 'dotenv'; dotenv.config(); export interface Config { + clientUrl: string; origin: string; port: number; version: string; @@ -33,12 +34,12 @@ export interface Config { password: string; }; database: string; - clientUrl: string; reportTokenSecret: string; } export const config = { port: parseInt(process.env.PORT, 10) || 3000, + clientUrl: process.env.CLIENT_URL, origin: process.env.ORIGIN, version: process.env.VERSION, reportTokenSecret: process.env.REPORT_TOKEN_SECRET, @@ -70,7 +71,6 @@ export const config = { password: process.env.CB_PASSWORD, }, database: process.env.DATABASE, - clientUrl: process.env.CLIENT_URL, }; export default config as Config; diff --git a/backend/src/main.ts b/backend/src/main.ts index d801221..195d745 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -69,7 +69,7 @@ const useMorgan = (app: NestExpressApplication) => { const enableCors = (app: NestExpressApplication) => { app.enableCors({ - origin: config.origin, + origin: [config.clientUrl, config.origin], methods: 'GET, HEAD, PUT, PATCH, POST, DELETE, OPTIONS', credentials: true, });