diff --git a/.gitignore b/.gitignore index 9a2b20b9..d5239596 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store dist/ node_modules/ @@ -6,3 +7,5 @@ node_modules/ script/comsol/words.json script/comsol/words.md + +.env diff --git a/package.json b/package.json index 531e9904..a0130a7f 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "@vuepress/shared": "2.0.0-beta.63", "@vuepress/utils": "2.0.0-beta.63", "axios": "0.27.2", + "dotenv": "17.2.3", "pnpm": "8.6.5", "sass-loader": "13.3.2", "vue": "3.3.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a70a4b0d..df673c13 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,6 +26,9 @@ importers: axios: specifier: 0.27.2 version: 0.27.2 + dotenv: + specifier: 17.2.3 + version: 17.2.3 pnpm: specifier: 8.6.5 version: 8.6.5 @@ -2060,6 +2063,10 @@ packages: dot-case@3.0.4: resolution: {integrity: sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==} + dotenv@17.2.3: + resolution: {integrity: sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w==} + engines: {node: '>=12'} + dunder-proto@1.0.1: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} @@ -7123,6 +7130,8 @@ snapshots: no-case: 3.0.4 tslib: 2.8.1 + dotenv@17.2.3: {} + dunder-proto@1.0.1: dependencies: call-bind-apply-helpers: 1.0.2 diff --git a/src/.vuepress/config.ts b/src/.vuepress/config.ts index b18a2ed9..fdf5dacd 100644 --- a/src/.vuepress/config.ts +++ b/src/.vuepress/config.ts @@ -2,6 +2,20 @@ import { defineUserConfig } from "@vuepress/cli"; import theme from "./theme"; import { searchPlugin } from '@vuepress/plugin-search' import { path } from "@vuepress/utils"; +import * as fs from 'fs'; // Necesario para verificar si el archivo `.env` existe +import * as dotenv from 'dotenv'; // Necesario para cargar el archivo de variables de entorno + +const envPath = path.resolve(__dirname, '../../.env'); +// Verifica si el archivo .env existe +if (fs.existsSync(envPath)) { + console.log(`Cargando variables desde: ${envPath}`); + + // 2. Carga las variables desde el archivo .env + // Nota: Por defecto, dotenv NO sobrescribe variables de entorno ya existentes. + dotenv.config({ path: envPath }); +} else { + console.log(`El archivo .env no existe en ${envPath}. Usando variables del entorno.`); +} // Configuración dinámica del base path según la rama // TODAS las ramas usan su propio base path (incluyendo la rama principal)