Skip to content

Commit

Permalink
Update mongo.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
wdhdev committed Dec 3, 2024
1 parent 2e728de commit c7d049c
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/lib/mongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ import * as Sentry from "@sentry/node";
require("dotenv").config();

export default async () => {
return mongoose.connect(process.env.MONGO_URI).then(() => {
console.log("Connected to Database!");
}).catch((err: Error) => {
Sentry.captureException(err);
console.error(err);
return mongoose
.connect(process.env.MONGO_URI, { dbName: process.env.DEVELOPMENT ? "reminders-dev" : "reminders-prod" })
.then(() => {
console.log("Connected to Database!");
})
.catch((err: Error) => {
Sentry.captureException(err);
console.error(err);

process.exit(1);
})
}
process.exit(1);
});
};

0 comments on commit c7d049c

Please sign in to comment.