Skip to content

Commit 4a94e14

Browse files
authored
Update dbConnection.js
MongoDB URL Parameter was not defined in env variable
1 parent 276f61a commit 4a94e14

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

config/dbConnection.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ require('dotenv').config();
33

44
const MongoDB_USER = process.env.MongoDB_USER;
55
const MongoDB_PASSWORD = process.env.MongoDB_PASSWORD;
6+
const MongoDB_URL = process.env.MongoDB_URL;
67

78
class MongoConnectionManager {
89
constructor(url, options) {
@@ -51,7 +52,7 @@ class MongoConnectionManager {
5152
}
5253

5354
// Example usage:
54-
const mongoURL = `mongodb://${MongoDB_USER}:${MongoDB_PASSWORD}@15.207.51.198:27017`;
55+
const mongoURL = `mongodb://${MongoDB_USER}:${MongoDB_PASSWORD}@${MongoDB_URL}`;
5556
const mongoOptions = { useNewUrlParser: true, useUnifiedTopology: true };
5657

5758
const connectionManager = new MongoConnectionManager(mongoURL, mongoOptions);
@@ -68,4 +69,4 @@ async function connectToDatabase(databaseName) {
6869

6970
module.exports = {
7071
connectToDatabase,
71-
};
72+
};

0 commit comments

Comments
 (0)