soundbirder/redis.js

18 lines
419 B
JavaScript
Raw Normal View History

2022-08-29 14:05:34 +02:00
const redis = require('redis');
const redisHost = process.env.REDIS_HOST ? process.env.REDIS_HOST : 'localhost';
const redisPort = process.env.REDIS_PORT ? process.env.REDIS_PORT : 6379;
2024-01-08 23:02:04 +01:00
2022-08-29 14:05:34 +02:00
const url = `redis://${redisHost}:${redisPort}`;
const redisClient = redis.createClient({
url,
legacyMode: true
});
(async () => {
2024-01-08 23:02:04 +01:00
redisClient.connect().catch(console.error)
2022-08-29 14:05:34 +02:00
})();
module.exports = {
redisClient
}