Variables de entorno
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sf-alvar/db-migrate",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"description": "Herramienta de migracion de bdd",
|
||||
"main": "lib/index.js",
|
||||
"engines": {
|
||||
|
||||
@@ -27,8 +27,9 @@ type DBVersion = {
|
||||
* Busca el .env en el directorio actual (CWD)
|
||||
*/
|
||||
async function loadEnv(envpath?: string) {
|
||||
const envPath = envpath ?? path.join(process.cwd(), '.env');
|
||||
if (existsSync(envPath)) {
|
||||
const env = process.env
|
||||
const envPath = envpath;
|
||||
if (envPath != undefined && existsSync(envPath)) {
|
||||
const content = await fs.readFile(envPath, 'utf-8');
|
||||
content.split('\n').forEach(line => {
|
||||
const [key, value] = line.split('=');
|
||||
@@ -36,6 +37,8 @@ async function loadEnv(envpath?: string) {
|
||||
});
|
||||
console.log('[i] Archivo .env cargado desde ' + envpath);
|
||||
console.log("ENV:", env)
|
||||
} else {
|
||||
console.log("[i] Variables de entorno locales")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user