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: db:
host: localhost host: localhost
port: 5432 port: 5432
#ssl: false
# Database name # Database name
db: calckey db: calckey
@ -48,7 +48,9 @@ db:
# Extra Connection options # Extra Connection options
#extra: #extra:
# ssl: true # ssl:
# host: localhost
# rejectUnauthorized: false
# ┌─────────────────────┐ # ┌─────────────────────┐
#───┘ Redis configuration └───────────────────────────────────── #───┘ Redis configuration └─────────────────────────────────────
@ -56,6 +58,9 @@ db:
redis: redis:
host: localhost host: localhost
port: 6379 port: 6379
#tls:
# host: localhost
# rejectUnauthorized: false
#family: 0 # 0=Both, 4=IPv4, 6=IPv6 #family: 0 # 0=Both, 4=IPv4, 6=IPv6
#pass: example-pass #pass: example-pass
#prefix: example-prefix #prefix: example-prefix

View File

@ -137,7 +137,9 @@ db:
# Extra Connection options # Extra Connection options
#extra: #extra:
# ssl: true # ssl:
# host: localhost
# rejectUnauthorized: false
# ┌─────────────────────┐ # ┌─────────────────────┐
#───┘ Redis configuration └───────────────────────────────────── #───┘ Redis configuration └─────────────────────────────────────
@ -154,6 +156,9 @@ redis:
#prefix: example-prefix #prefix: example-prefix
#db: 1 #db: 1
#user: default #user: default
#tls:
# host: localhost
# rejectUnauthorized: false
# ┌─────────────────────┐ # ┌─────────────────────┐
#───┘ Sonic configuration └───────────────────────────────────── #───┘ Sonic configuration └─────────────────────────────────────

View File

@ -12,8 +12,4 @@ 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

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

View File

@ -211,10 +211,7 @@ export const db = new DataSource({
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: { tls: config.redis.tls || {},
host: config.redis.host,
rejectUnauthorized: false,
},
}, },
} }
: false, : false,
@ -223,10 +220,6 @@ 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

@ -10,10 +10,7 @@ export function createConnection() {
username: config.redis.user ?? "default", username: config.redis.user ?? "default",
keyPrefix: `${config.redis.prefix}:`, keyPrefix: `${config.redis.prefix}:`,
db: config.redis.db || 0, db: config.redis.db || 0,
tls: { tls: config.redis.tls || {},
rejectUnauthorized: false,
host: config.redis.host,
},
}); });
} }

View File

@ -10,9 +10,7 @@ export function initialize<T>(name: string, limitPerSec = -1) {
user: config.redis.user ?? "default", user: config.redis.user ?? "default",
password: config.redis.pass, password: config.redis.pass,
db: config.redis.db || 0, db: config.redis.db || 0,
tls: { tls: config.redis.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: