Skip to content

Commit

Permalink
crashing container when there is mongo connection error
Browse files Browse the repository at this point in the history
  • Loading branch information
batamar committed Nov 17, 2022
1 parent f0aa394 commit 2002aab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/api-plugin-template.erxes/src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ mongoose.connection
})
.on('disconnected', () => {
debugInfo(`Disconnected from the database: ${MONGO_URL}`);

process.exit(1);
})
.on('error', error => {
debugError(`Database connection error: ${MONGO_URL} ${error}`);

process.exit(1);
});

export const connect = (URL?: string) => {
Expand Down

0 comments on commit 2002aab

Please sign in to comment.