fix: 🐛 support for SSL data when loading redis and postgres configs

Closes #10366
This commit is contained in:
Ashex 2023-06-26 14:54:16 -07:00 committed by ThatOneCalculator
parent 7575a04a5f
commit 3df3c97deb
No known key found for this signature in database
GPG key ID: 8703CACD01000000
4 changed files with 22 additions and 0 deletions

View file

@ -12,4 +12,8 @@ export default new DataSource({
extra: config.db.extra, extra: config.db.extra,
entities: entities, entities: entities,
migrations: ["migration/*.js"], migrations: ["migration/*.js"],
ssl: {
rejectUnauthorized: false,
ca: process.env.DB_SSL_CERT,
},
}); });

View file

@ -207,9 +207,14 @@ export const db = new DataSource({
host: config.redis.host, host: config.redis.host,
port: config.redis.port, port: config.redis.port,
family: config.redis.family == null ? 0 : config.redis.family, family: config.redis.family == null ? 0 : config.redis.family,
user: "default",
password: config.redis.pass, password: config.redis.pass,
keyPrefix: `${config.redis.prefix}:query:`, keyPrefix: `${config.redis.prefix}:query:`,
db: config.redis.db || 0, db: config.redis.db || 0,
tls: {
host: config.redis.host,
rejectUnauthorized: false,
},
}, },
} }
: false, : false,
@ -218,6 +223,10 @@ export const db = new DataSource({
maxQueryExecutionTime: 300, maxQueryExecutionTime: 300,
entities: entities, entities: entities,
migrations: ["../../migration/*.js"], migrations: ["../../migration/*.js"],
ssl: {
rejectUnauthorized: false,
ca: process.env.DB_SSL_CERT,
},
}); });
export async function initDb(force = false) { export async function initDb(force = false) {

View file

@ -7,8 +7,13 @@ export function createConnection() {
host: config.redis.host, host: config.redis.host,
family: config.redis.family == null ? 0 : config.redis.family, family: config.redis.family == null ? 0 : config.redis.family,
password: config.redis.pass, password: config.redis.pass,
username: "default",
keyPrefix: `${config.redis.prefix}:`, keyPrefix: `${config.redis.prefix}:`,
db: config.redis.db || 0, db: config.redis.db || 0,
tls: {
rejectUnauthorized: false,
host: config.redis.host,
},
}); });
} }

View file

@ -7,8 +7,12 @@ export function initialize<T>(name: string, limitPerSec = -1) {
port: config.redis.port, port: config.redis.port,
host: config.redis.host, host: config.redis.host,
family: config.redis.family == null ? 0 : config.redis.family, family: config.redis.family == null ? 0 : config.redis.family,
user: "default",
password: config.redis.pass, password: config.redis.pass,
db: config.redis.db || 0, db: config.redis.db || 0,
tls: {
host: config.redis.host,
},
}, },
prefix: config.redis.prefix ? `${config.redis.prefix}:queue` : "queue", prefix: config.redis.prefix ? `${config.redis.prefix}:queue` : "queue",
limiter: limiter: