18 lines
419 B
JavaScript
Executable File
18 lines
419 B
JavaScript
Executable File
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;
|
|
|
|
const url = `redis://${redisHost}:${redisPort}`;
|
|
const redisClient = redis.createClient({
|
|
url,
|
|
legacyMode: true
|
|
});
|
|
|
|
(async () => {
|
|
redisClient.connect().catch(console.error)
|
|
})();
|
|
|
|
module.exports = {
|
|
redisClient
|
|
} |