Merge pull request '[PR]: Make TLS opttional for postgres and redis' (#10375) from sparrow/calckey:develop into develop

Reviewed-on: https://codeberg.org/calckey/calckey/pulls/10375
This commit is contained in:
Kainoa Kanter 2023-06-28 03:11:17 +00:00
commit 48a9fd703d
7 changed files with 17 additions and 22 deletions

View File

@ -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

View File

@ -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 └─────────────────────────────────────

View File

@ -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,
},
});

View File

@ -24,6 +24,7 @@ export type Source = {
db?: number;
prefix?: string;
user?: string;
tls?: { [x: string]: string };
};
elasticsearch: {
host: string;

View File

@ -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) {

View File

@ -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 || {},
});
}

View File

@ -10,9 +10,7 @@ export function initialize<T>(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: