2023-04-14 04:50:05 +00:00
|
|
|
import * as Redis from 'ioredis';
|
2023-02-26 11:07:45 +00:00
|
|
|
import { loadConfig } from './built/config.js';
|
2023-02-24 05:09:17 +00:00
|
|
|
|
|
|
|
const config = loadConfig();
|
2023-04-07 02:20:14 +00:00
|
|
|
const redis = new Redis({
|
|
|
|
port: config.redis.port,
|
|
|
|
host: config.redis.host,
|
|
|
|
family: config.redis.family == null ? 0 : config.redis.family,
|
|
|
|
password: config.redis.pass,
|
|
|
|
keyPrefix: `${config.redis.prefix}:`,
|
|
|
|
db: config.redis.db ?? 0,
|
|
|
|
});
|
2023-02-24 05:09:17 +00:00
|
|
|
|
|
|
|
redis.on('connect', () => redis.disconnect());
|
|
|
|
redis.on('error', (e) => {
|
2023-02-26 11:07:52 +00:00
|
|
|
throw e;
|
2023-02-24 05:09:17 +00:00
|
|
|
});
|