feat(backend): イベント用Redisを別サーバーに分離できるように
This commit is contained in:
parent
f4588f3907
commit
ff6d9d2860
15 changed files with 98 additions and 51 deletions
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue