mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-30 22:07:39 -07:00
22 lines
503 B
TypeScript
22 lines
503 B
TypeScript
import Redis from "ioredis";
|
|
import config from "@/config/index.js";
|
|
|
|
export function createConnection() {
|
|
let source = config.redis;
|
|
|
|
return new Redis({
|
|
port: source.port,
|
|
host: source.host,
|
|
family: source.family ?? 0,
|
|
password: source.pass,
|
|
username: source.user ?? "default",
|
|
keyPrefix: `${source.prefix}:`,
|
|
db: source.db || 0,
|
|
tls: source.tls,
|
|
});
|
|
}
|
|
|
|
export const subscriber = createConnection();
|
|
subscriber.subscribe(config.host);
|
|
|
|
export const redisClient = createConnection();
|