aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-04-19 09:25:11 +0200
committerChocobozzz <me@florianbigard.com>2021-04-19 09:25:11 +0200
commit6bc672da815cf7315abd5b5a6267a07b9ad2345e (patch)
treee427b10cfc46398b58730c8d6de68cf4b3651429
parentb9244002fcc48dda7f3a588980d910a40429238f (diff)
downloadPeerTube-6bc672da815cf7315abd5b5a6267a07b9ad2345e.tar.gz
PeerTube-6bc672da815cf7315abd5b5a6267a07b9ad2345e.tar.zst
PeerTube-6bc672da815cf7315abd5b5a6267a07b9ad2345e.zip
Fix database ssl connection
-rw-r--r--server/initializers/database.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/server/initializers/database.ts b/server/initializers/database.ts
index 1f2b6d521..243795e60 100644
--- a/server/initializers/database.ts
+++ b/server/initializers/database.ts
@@ -51,18 +51,27 @@ const dbname = CONFIG.DATABASE.DBNAME
51const username = CONFIG.DATABASE.USERNAME 51const username = CONFIG.DATABASE.USERNAME
52const password = CONFIG.DATABASE.PASSWORD 52const password = CONFIG.DATABASE.PASSWORD
53const host = CONFIG.DATABASE.HOSTNAME 53const host = CONFIG.DATABASE.HOSTNAME
54const ssl = CONFIG.DATABASE.SSL
55const port = CONFIG.DATABASE.PORT 54const port = CONFIG.DATABASE.PORT
56const poolMax = CONFIG.DATABASE.POOL.MAX 55const poolMax = CONFIG.DATABASE.POOL.MAX
57 56
57let dialectOptions: any = {}
58
59if (CONFIG.DATABASE.SSL) {
60 dialectOptions = {
61 ssl: {
62 rejectUnauthorized: false
63 }
64 }
65}
66
58const sequelizeTypescript = new SequelizeTypescript({ 67const sequelizeTypescript = new SequelizeTypescript({
59 database: dbname, 68 database: dbname,
60 dialect: 'postgres', 69 dialect: 'postgres',
70 dialectOptions,
61 host, 71 host,
62 port, 72 port,
63 username, 73 username,
64 password, 74 password,
65 ssl,
66 pool: { 75 pool: {
67 max: poolMax 76 max: poolMax
68 }, 77 },