From ae00a43c91939729bc05b213df893803742931f5 Mon Sep 17 00:00:00 2001 From: David Arranz Date: Sun, 8 Sep 2024 21:20:19 +0200 Subject: [PATCH] - --- server/src/config/index.ts | 29 ++++++++++++------------ server/src/infrastructure/http/server.ts | 2 +- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/server/src/config/index.ts b/server/src/config/index.ts index 2f58c41..40fe5d0 100644 --- a/server/src/config/index.ts +++ b/server/src/config/index.ts @@ -1,21 +1,20 @@ /* eslint-disable @typescript-eslint/no-var-requires */ -import path from 'path'; +import path from "path"; -const enviroment = process.env.NODE_ENV || 'development'; -const isProduction = enviroment === 'production'; -const isDevelopment = enviroment === 'development'; +const environment = process.env.NODE_ENV || "development"; +const isProduction = environment === "production"; +const isDevelopment = environment === "development"; -const enviromentConfig = require(path.resolve( - __dirname, - 'environments', - enviroment + '.ts' -)); +// Determina la extensión de archivo según el entorno +const extension = isProduction ? ".js" : ".ts"; + +const environmentConfig = require(path.resolve(__dirname, "environments", environment + extension)); export const config = Object.assign( - { - enviroment, - isProduction, - isDevelopment, - }, - enviromentConfig + { + environment, + isProduction, + isDevelopment, + }, + environmentConfig ); diff --git a/server/src/infrastructure/http/server.ts b/server/src/infrastructure/http/server.ts index 198b773..c6a2d6b 100644 --- a/server/src/infrastructure/http/server.ts +++ b/server/src/infrastructure/http/server.ts @@ -23,7 +23,7 @@ export const currentState = assign( appPath: process.cwd(), //host: process.env.HOST || process.env.HOSTNAME || 'localhost', //port: process.env.PORT || 18888, - environment: config.enviroment, + environment: config.environment, connections: {}, }, config