From 1432a7193d338b7945f2a285614f5068397d3fe9 Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Tue, 11 Jun 2019 20:49:08 +0900 Subject: [PATCH] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E3=81=A7PostgreSQL=E3=81=AE?= =?UTF-8?q?=E3=82=AF=E3=82=A8=E3=83=AA=E3=83=BC=E7=B5=90=E6=9E=9C=E3=81=AE?= =?UTF-8?q?=E3=82=AD=E3=83=A3=E3=83=83=E3=82=B7=E3=83=A5=E3=82=92=E7=84=A1?= =?UTF-8?q?=E5=8A=B9=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=20(#5046)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/example.yml | 3 +++ src/config/types.ts | 1 + src/db/postgre.ts | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.config/example.yml b/.config/example.yml index 503471d93..8534d3e1e 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -62,6 +62,9 @@ db: user: example-misskey-user pass: example-misskey-pass + # Whether disable Caching queries + #disableCache: true + # Extra Connection options #extra: # ssl: true diff --git a/src/config/types.ts b/src/config/types.ts index c35bc6357..be3575d28 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -14,6 +14,7 @@ export type Source = { db: string; user: string; pass: string; + disableCache?: boolean; extra?: { [x: string]: string }; }; redis: { diff --git a/src/db/postgre.ts b/src/db/postgre.ts index f0f1e7eec..c91cd8e1d 100644 --- a/src/db/postgre.ts +++ b/src/db/postgre.ts @@ -96,7 +96,7 @@ export function initDb(justBorrow = false, sync = false, log = false) { extra: config.db.extra, synchronize: process.env.NODE_ENV === 'test' || sync, dropSchema: process.env.NODE_ENV === 'test' && !justBorrow, - cache: { + cache: !config.db.disableCache ? { type: 'redis', options: { host: config.redis.host, @@ -107,7 +107,7 @@ export function initDb(justBorrow = false, sync = false, log = false) { db: config.redis.db || 0 } } - }, + } : false, logging: log, logger: log ? new MyCustomLogger() : undefined, entities: [