]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Better error message on postgresql connection err
authorChocobozzz <me@florianbigard.com>
Mon, 24 Aug 2020 09:33:59 +0000 (11:33 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 24 Aug 2020 09:34:15 +0000 (11:34 +0200)
server/initializers/database.ts

index 8ce32f6fa9bf945f59484e74014d3521845e32f0..5cf5765f681b09ccb63724bf64e8294c46249157 100644 (file)
@@ -75,6 +75,14 @@ const sequelizeTypescript = new SequelizeTypescript({
   }
 })
 
+sequelizeTypescript.authenticate()
+  .then(() => logger.debug('Connection to PostgreSQL has been established successfully.'))
+  .catch(err => {
+
+    logger.error('Unable to connect to PostgreSQL database.', { err })
+    process.exit(-1)
+  })
+
 async function initDatabaseModels (silent: boolean) {
   sequelizeTypescript.addModels([
     ApplicationModel,