expose redis tls settings directly to config

This commit is contained in:
sparrow 2023-06-28 03:09:22 +01:00
parent 0f164cea4e
commit 6a033513ea
5 changed files with 7 additions and 13 deletions

View File

@ -58,7 +58,9 @@ db:
redis:
host: localhost
port: 6379
#tls: false
#tls:
# host: localhost
# rejectUnauthorized: false
#family: 0 # 0=Both, 4=IPv4, 6=IPv6
#pass: example-pass
#prefix: example-prefix

View File

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