From 6de08d07a3d5cc4db2c9900f59a66ccca8643918 Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Fri, 24 May 2019 03:26:56 +0900 Subject: [PATCH] Support PostgreSQL Extra Connection options (#4970) --- .config/example.yml | 4 ++++ src/config/types.ts | 1 + src/db/postgre.ts | 1 + src/ormconfig.ts | 1 + 4 files changed, 7 insertions(+) diff --git a/.config/example.yml b/.config/example.yml index 0babd037c..503471d93 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -62,6 +62,10 @@ db: user: example-misskey-user pass: example-misskey-pass + # Extra Connection options + #extra: + # ssl: true + # ┌─────────────────────┐ #───┘ Redis configuration └───────────────────────────────────── diff --git a/src/config/types.ts b/src/config/types.ts index 7da9820f2..c35bc6357 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -14,6 +14,7 @@ export type Source = { db: string; user: string; pass: string; + extra?: { [x: string]: string }; }; redis: { host: string; diff --git a/src/db/postgre.ts b/src/db/postgre.ts index fcec68602..04893efe2 100644 --- a/src/db/postgre.ts +++ b/src/db/postgre.ts @@ -93,6 +93,7 @@ export function initDb(justBorrow = false, sync = false, log = false) { username: config.db.user, password: config.db.pass, database: config.db.db, + extra: config.db.extra, synchronize: process.env.NODE_ENV === 'test' || sync, dropSchema: process.env.NODE_ENV === 'test' && !justBorrow, logging: log, diff --git a/src/ormconfig.ts b/src/ormconfig.ts index 91f33181f..6b7297b2c 100644 --- a/src/ormconfig.ts +++ b/src/ormconfig.ts @@ -8,6 +8,7 @@ const json = { username: config.db.user, password: config.db.pass, database: config.db.db, + extra: config.db.extra, entities: ['src/models/entities/*.ts'], migrations: ['migration/*.ts'], cli: {