diff --git a/.config/example.yml b/.config/example.yml index b96dc643b..51d380e7e 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -58,7 +58,9 @@ db: redis: host: localhost port: 6379 - #tls: false + #tls: + # host: localhost + # rejectUnauthorized: false #family: 0 # 0=Both, 4=IPv4, 6=IPv6 #pass: example-pass #prefix: example-prefix diff --git a/packages/backend/src/config/types.ts b/packages/backend/src/config/types.ts index 028403374..cbe27543b 100644 --- a/packages/backend/src/config/types.ts +++ b/packages/backend/src/config/types.ts @@ -24,7 +24,7 @@ export type Source = { db?: number; prefix?: string; user?: string; - tls?: boolean; + tls?: { [x: string]: string }; }; elasticsearch: { host: string; diff --git a/packages/backend/src/db/postgre.ts b/packages/backend/src/db/postgre.ts index a3f065e19..f632a6ec4 100644 --- a/packages/backend/src/db/postgre.ts +++ b/packages/backend/src/db/postgre.ts @@ -211,10 +211,7 @@ export const db = new DataSource({ password: config.redis.pass, keyPrefix: `${config.redis.prefix}:query:`, db: config.redis.db || 0, - tls: config.redis.tls ? { - host: config.redis.host, - rejectUnauthorized: false, // TODO make configurable - } : {}, + tls: config.redis.tls || {} , }, } : false, diff --git a/packages/backend/src/db/redis.ts b/packages/backend/src/db/redis.ts index 0d353d3ce..24563661e 100644 --- a/packages/backend/src/db/redis.ts +++ b/packages/backend/src/db/redis.ts @@ -10,10 +10,7 @@ export function createConnection() { username: config.redis.user ?? "default", keyPrefix: `${config.redis.prefix}:`, db: config.redis.db || 0, - tls: config.redis.tls ? { - rejectUnauthorized: false, //TODO make configurable - host: config.redis.host, - } : {}, + tls: config.redis.tls || {}, }); } diff --git a/packages/backend/src/queue/initialize.ts b/packages/backend/src/queue/initialize.ts index d5cf2b908..8d728df5b 100644 --- a/packages/backend/src/queue/initialize.ts +++ b/packages/backend/src/queue/initialize.ts @@ -10,9 +10,7 @@ export function initialize(name: string, limitPerSec = -1) { user: config.redis.user ?? "default", password: config.redis.pass, db: config.redis.db || 0, - tls: config.redis.tls ? { - host: config.redis.host, //TODO add configurable cert validation - } : {}, + tls: config.redis.tls || {}, }, prefix: config.redis.prefix ? `${config.redis.prefix}:queue` : "queue", limiter: