diff --git a/.config/example.yml b/.config/example.yml index ee61ebe25c..51d380e7e7 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -35,7 +35,7 @@ port: 3000 db: host: localhost port: 5432 - + #ssl: false # Database name db: calckey @@ -48,7 +48,9 @@ db: # Extra Connection options #extra: - # ssl: true + # ssl: + # host: localhost + # rejectUnauthorized: false # ┌─────────────────────┐ #───┘ Redis configuration └───────────────────────────────────── @@ -56,6 +58,9 @@ db: redis: host: localhost port: 6379 + #tls: + # host: localhost + # rejectUnauthorized: false #family: 0 # 0=Both, 4=IPv4, 6=IPv6 #pass: example-pass #prefix: example-prefix diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl index 62ff2f8ff0..81009ed017 100644 --- a/chart/templates/_helpers.tpl +++ b/chart/templates/_helpers.tpl @@ -137,7 +137,9 @@ db: # Extra Connection options #extra: - # ssl: true + # ssl: + # host: localhost + # rejectUnauthorized: false # ┌─────────────────────┐ #───┘ Redis configuration └───────────────────────────────────── @@ -154,6 +156,9 @@ redis: #prefix: example-prefix #db: 1 #user: default + #tls: + # host: localhost + # rejectUnauthorized: false # ┌─────────────────────┐ #───┘ Sonic configuration └───────────────────────────────────── diff --git a/packages/backend/ormconfig.js b/packages/backend/ormconfig.js index c230e09fd5..5f85cead8a 100644 --- a/packages/backend/ormconfig.js +++ b/packages/backend/ormconfig.js @@ -12,8 +12,4 @@ export default new DataSource({ extra: config.db.extra, entities: entities, migrations: ["migration/*.js"], - ssl: { - rejectUnauthorized: false, - ca: process.env.DB_SSL_CERT, - }, }); diff --git a/packages/backend/src/config/types.ts b/packages/backend/src/config/types.ts index e9d1dbb645..cbe27543b3 100644 --- a/packages/backend/src/config/types.ts +++ b/packages/backend/src/config/types.ts @@ -24,6 +24,7 @@ export type Source = { db?: number; prefix?: string; user?: string; + tls?: { [x: string]: string }; }; elasticsearch: { host: string; diff --git a/packages/backend/src/db/postgre.ts b/packages/backend/src/db/postgre.ts index 0a0802a3a8..1ba226a8e1 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: { - host: config.redis.host, - rejectUnauthorized: false, - }, + tls: config.redis.tls || {}, }, } : false, @@ -223,10 +220,6 @@ export const db = new DataSource({ maxQueryExecutionTime: 300, entities: entities, migrations: ["../../migration/*.js"], - ssl: { - rejectUnauthorized: false, - ca: process.env.DB_SSL_CERT, - }, }); export async function initDb(force = false) { diff --git a/packages/backend/src/db/redis.ts b/packages/backend/src/db/redis.ts index a54bad2e7a..24563661e9 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: { - rejectUnauthorized: false, - 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 5d96f7747d..8d728df5be 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: { - host: config.redis.host, - }, + tls: config.redis.tls || {}, }, prefix: config.redis.prefix ? `${config.redis.prefix}:queue` : "queue", limiter: