Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
/node_modules
/dist
/data

.idea
15 changes: 2 additions & 13 deletions src/data.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import * as dotenv from "dotenv";

dotenv.config();
let path;
switch (process.env.NODE_ENV) {
case "production":
path = `${__dirname}/./../.env.production`;
break;
default:
path = `${__dirname}/./../.env.development`;
}
dotenv.config({ path: path });
import { PASSWORD_ENV } from "./utils/config";

export const data = {
contactInfo: {
Expand All @@ -21,7 +10,7 @@ export const data = {
username: "Jimmygabriel",
},
credentials: {
password: `${process.env.PASSWORD_ENV}`,
password: `${PASSWORD_ENV}`,
},
personalInfo: {
questions: [
Expand Down
14 changes: 14 additions & 0 deletions src/utils/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as dotenv from "dotenv";

dotenv.config();
let path;
switch (process.env.NODE_ENV) {
case "production":
path = `${__dirname}/../../.env.production`;
break;
default:
path = `${__dirname}/../../.env.development`;
}
dotenv.config({ path: path });

export const PASSWORD_ENV = process.env.PASSWORD_ENV;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esta es buena iniciativa, aunque no se recomienda utilizar .env-production y .env-[cualquiera]. Siempre utiliza un solo .env porque en tu sesión sólo hay 1 ambiente.

Copy link
Copy Markdown
Author

@byJim byJim Jun 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@netpoe gracias, atendi ya tu comentario.