From 8085ac401b9c1715f1f78480f63f3a18519304ee Mon Sep 17 00:00:00 2001 From: Facundo Inza Date: Tue, 3 Oct 2023 13:55:05 -0400 Subject: [PATCH] fix: Current enviroment changes --- config/development.ts | 2 ++ config/production.ts | 4 +++- interceptors/index.ts | 3 ++- package.json | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config/development.ts b/config/development.ts index c481ecd..0fd746b 100644 --- a/config/development.ts +++ b/config/development.ts @@ -1,6 +1,8 @@ export default { NODE_ENV: process.env.NODE_ENV || 'development', PORT: process.env.PORT || 3000, + DELIVERIT_API_BASE_URL: + process.env.DELIVERIT_API_BASE_URL || 'http://localhost:5000', BASE_URL: process.env.DELIVERIT_API_BASE_URL || 'http://localhost:5000', ACCESS_TOKEN_SECRET: process.env.ACCESS_TOKEN_SECRET || 'mysecrettoken', NEXT_PUBLIC_GOOGLE_API_KEY: process.env.NEXT_PUBLIC_GOOGLE_API_KEY || '', diff --git a/config/production.ts b/config/production.ts index e25626a..3b6a957 100644 --- a/config/production.ts +++ b/config/production.ts @@ -1,7 +1,9 @@ export default { NODE_ENV: process.env.NODE_ENV || 'production', PORT: process.env.PORT || 3000, - BASE_URL: process.env.DELIVERIT_API_BASE_URL || 'http://deliverit.tech', + DELIVERIT_API_BASE_URL: + process.env.DELIVERIT_API_BASE_URL || 'http://api.deliverit.tech', + BASE_URL: process.env.DELIVERIT_API_BASE_URL || 'http://api.deliverit.tech', ACCESS_TOKEN_SECRET: process.env.ACCESS_TOKEN_SECRET || 'mysecrettoken', NEXT_PUBLIC_GOOGLE_API_KEY: process.env.NEXT_PUBLIC_GOOGLE_API_KEY || '', }; diff --git a/interceptors/index.ts b/interceptors/index.ts index 1e5a604..c1a0134 100644 --- a/interceptors/index.ts +++ b/interceptors/index.ts @@ -1,3 +1,4 @@ +import currentEnv from '@/config'; import axios from 'axios'; import { cookies } from 'next/dist/client/components/headers'; @@ -19,7 +20,7 @@ function handleNetworkErrors(error: Error) { // ConfiguraciĆ³n de Axios con los interceptores export const axiosInstance = axios.create({ - baseURL: process.env.DELIVERIT_API_BASE_URL, + baseURL: currentEnv.DELIVERIT_API_BASE_URL, headers: { 'Content-Type': 'application/json', }, diff --git a/package.json b/package.json index 4649a9b..acdeb14 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev", + "dev": "NODE_ENV=development next dev", "build": "next build", "start": "next start", "lint": "next lint",