modificada variable de entorno host en api

This commit is contained in:
2025-06-16 22:54:33 -04:00
parent 92d64db33a
commit 8216cb4e09
3 changed files with 7 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
# Server Configuration # Server Configuration
HOST=localhost HOST_API=localhost
PORT=8000 PORT=8000
ALLOW_CORS_URL=http://localhost:3000 ALLOW_CORS_URL=http://localhost:3000
NODE_ENV='development' #development | production NODE_ENV='development' #development | production

View File

@@ -30,6 +30,6 @@ export const bootstrap = async (app: NestExpressApplication) => {
await swagger(app); await swagger(app);
await app.listen(envs.port!, () => { await app.listen(envs.port!, () => {
logger.log(`This application started at ${envs.host}:${envs.port}`); logger.log(`This application started at ${envs.host_api}:${envs.port}`);
}); });
}; };

View File

@@ -2,7 +2,7 @@ import 'dotenv/config';
import * as joi from 'joi'; import * as joi from 'joi';
interface EnvVars { interface EnvVars {
HOST: string; HOST_API: string;
ALLOW_CORS_URL: string; ALLOW_CORS_URL: string;
PORT: number; PORT: number;
NODE_ENV: string; NODE_ENV: string;
@@ -14,12 +14,11 @@ interface EnvVars {
MAIL_HOST: string; MAIL_HOST: string;
MAIL_USERNAME: string; MAIL_USERNAME: string;
MAIL_PASSWORD: string; MAIL_PASSWORD: string;
} }
const envsSchema = joi const envsSchema = joi
.object({ .object({
HOST: joi.string().required(), HOST_API: joi.string().required(),
ALLOW_CORS_URL: joi.string().required(), ALLOW_CORS_URL: joi.string().required(),
PORT: joi.number().required(), PORT: joi.number().required(),
NODE_ENV: joi.string().required(), NODE_ENV: joi.string().required(),
@@ -46,13 +45,13 @@ export const envs = {
port: envVars.PORT, port: envVars.PORT,
dataBaseUrl: envVars.DATABASE_URL, dataBaseUrl: envVars.DATABASE_URL,
node_env: envVars.NODE_ENV, node_env: envVars.NODE_ENV,
host: envVars.HOST, host_api: envVars.HOST_API,
allow_cors_url: envVars.ALLOW_CORS_URL, allow_cors_url: envVars.ALLOW_CORS_URL,
access_token_secret: envVars.ACCESS_TOKEN_SECRET, access_token_secret: envVars.ACCESS_TOKEN_SECRET,
access_token_expiration: envVars.ACCESS_TOKEN_EXPIRATION, access_token_expiration: envVars.ACCESS_TOKEN_EXPIRATION,
refresh_token_secret: envVars.REFRESH_TOKEN_SECRET, refresh_token_secret: envVars.REFRESH_TOKEN_SECRET,
refresh_token_expiration: envVars.REFRESH_TOKEN_EXPIRATION, refresh_token_expiration: envVars.REFRESH_TOKEN_EXPIRATION,
mail_host: envVars.MAIL_HOST, mail_host: envVars.MAIL_HOST,
mail_username: envVars.MAIL_USERNAME, mail_username: envVars.MAIL_USERNAME,
mail_password: envVars.MAIL_PASSWORD mail_password: envVars.MAIL_PASSWORD,
}; };