]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix database ssl connection
authorChocobozzz <me@florianbigard.com>
Mon, 19 Apr 2021 07:25:11 +0000 (09:25 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 19 Apr 2021 07:25:11 +0000 (09:25 +0200)
server/initializers/database.ts

index 1f2b6d5211c18b335759536810ac2cf8729a089c..243795e60af264c0ebccd5794b7f9c117270e8b0 100644 (file)
@@ -51,18 +51,27 @@ const dbname = CONFIG.DATABASE.DBNAME
 const username = CONFIG.DATABASE.USERNAME
 const password = CONFIG.DATABASE.PASSWORD
 const host = CONFIG.DATABASE.HOSTNAME
-const ssl = CONFIG.DATABASE.SSL
 const port = CONFIG.DATABASE.PORT
 const poolMax = CONFIG.DATABASE.POOL.MAX
 
+let dialectOptions: any = {}
+
+if (CONFIG.DATABASE.SSL) {
+  dialectOptions = {
+    ssl: {
+      rejectUnauthorized: false
+    }
+  }
+}
+
 const sequelizeTypescript = new SequelizeTypescript({
   database: dbname,
   dialect: 'postgres',
+  dialectOptions,
   host,
   port,
   username,
   password,
-  ssl,
   pool: {
     max: poolMax
   },