summaryrefslogtreecommitdiff
path: root/packages/backend/check_connect.js
blob: ef0a350fbfb8a626e892741b0060ff8547f963cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import Redis from 'ioredis';
import { loadConfig } from './built/config.js';

const config = loadConfig();
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) => {
	throw e;
});