Skip to content

update var .env stage #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 7 additions & 0 deletions .env.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NODE_ENV=prod
DB_HOST=localhost
DB_PORT=5432
DB_USER=your_db_user
DB_NAME=your_db_name
DB_PASSWORD=your_db_password
JWT_SECRET_KEY=your_secret_key
7 changes: 7 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NODE_ENV=test
DB_HOST=localhost
DB_PORT=5432
DB_USER=your_db_user
DB_NAME=your_db_name
DB_PASSWORD=your_db_password
JWT_SECRET_KEY=your_secret_key
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ web_modules/

# dotenv environment variable files
.env
.env.dev
.env.development.local
.env.test.local
.env.production.local
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ const { swaggerUi, swaggerSpec } = require('./config/swagger'); // Import Swagge
const metricsRoutes = require('./routes/metricsRoutes');
const { trackRequests } = require('./controllers/metricsController');

dotenv.config();
dotenv.config({
path: `.env.${process.env.NODE_ENV || 'dev'}`,
});

const app = express();
const port = process.env.PORT || 3000;
Expand Down
7 changes: 0 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
]
},
"scripts": {
"test": "DEBUG=module:* nyc mocha --require @babel/register",
"start": "node src/index.js",
"dev": "nodemon src/index.js"
"test": "NODE_ENV=prod DEBUG=module:* nyc mocha --require @babel/register",
"start": "NODE_ENV=prod node index.js",
"start:dev": "node index.js"
}
}
Loading