expose redis tls settings directly to config

This commit is contained in:
sparrow 2023-06-28 03:09:22 +01:00
parent 2f1e9696a8
commit f0256b08ff
5 changed files with 7 additions and 13 deletions

View File

@ -58,7 +58,9 @@ db:
redis: redis:
host: localhost host: localhost
port: 6379 port: 6379
#tls: false #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

@ -24,7 +24,7 @@ export type Source = {
db?: number; db?: number;
prefix?: string; prefix?: string;
user?: string; user?: string;
tls?: boolean; 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: config.redis.tls ? { tls: config.redis.tls || {} ,
host: config.redis.host,
rejectUnauthorized: false, // TODO make configurable
} : {},
}, },
} }
: false, : 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: config.redis.tls ? { tls: config.redis.tls || {},
rejectUnauthorized: false, //TODO make configurable
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: config.redis.tls ? { tls: config.redis.tls || {},
host: config.redis.host, //TODO add configurable cert validation
} : {},
}, },
prefix: config.redis.prefix ? `${config.redis.prefix}:queue` : "queue", prefix: config.redis.prefix ? `${config.redis.prefix}:queue` : "queue",
limiter: limiter: