feat(backend): イベント用Redisを別サーバーに分離できるように

This commit is contained in:
syuilo 2023-04-07 11:20:14 +09:00
parent f4588f3907
commit ff6d9d2860
15 changed files with 98 additions and 51 deletions

View file

@ -1,8 +1,15 @@
import Redis from 'ioredis';
import { loadConfig } from './built/config.js';
import { createRedisConnection } from './built/redis.js';
const config = loadConfig();
const redis = createRedisConnection(config);
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,
});
redis.on('connect', () => redis.disconnect());
redis.on('error', (e) => {