aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/database.ts17
1 files changed, 10 insertions, 7 deletions
diff --git a/server/initializers/database.ts b/server/initializers/database.ts
index e05e7c335..a20cdacc3 100644
--- a/server/initializers/database.ts
+++ b/server/initializers/database.ts
@@ -77,13 +77,15 @@ const sequelizeTypescript = new SequelizeTypescript({
77 } 77 }
78}) 78})
79 79
80sequelizeTypescript.authenticate() 80function checkDatabaseConnectionOrDie () {
81 .then(() => logger.debug('Connection to PostgreSQL has been established successfully.')) 81 sequelizeTypescript.authenticate()
82 .catch(err => { 82 .then(() => logger.debug('Connection to PostgreSQL has been established successfully.'))
83 83 .catch(err => {
84 logger.error('Unable to connect to PostgreSQL database.', { err }) 84
85 process.exit(-1) 85 logger.error('Unable to connect to PostgreSQL database.', { err })
86 }) 86 process.exit(-1)
87 })
88}
87 89
88async function initDatabaseModels (silent: boolean) { 90async function initDatabaseModels (silent: boolean) {
89 sequelizeTypescript.addModels([ 91 sequelizeTypescript.addModels([
@@ -140,6 +142,7 @@ async function initDatabaseModels (silent: boolean) {
140 142
141export { 143export {
142 initDatabaseModels, 144 initDatabaseModels,
145 checkDatabaseConnectionOrDie,
143 sequelizeTypescript 146 sequelizeTypescript
144} 147}
145 148