Fixed some bugs in api and auth services, completed auth cores.
This commit is contained in:
18
stream/src/data/redis.js
Normal file
18
stream/src/data/redis.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import Redis from 'ioredis';
|
||||
|
||||
const baseOpts = {
|
||||
host: process.env.REDIS_HOST,
|
||||
port: Number(process.env.REDIS_PORT),
|
||||
password: process.env.REDIS_PASSWORD,
|
||||
};
|
||||
|
||||
// Client principale: SET/GET/SETEX/GETDEL/INCR/PUBLISH
|
||||
const client = new Redis(baseOpts);
|
||||
|
||||
// Client dedicato per SUBSCRIBE (ioredis non permette comandi normali su un client subscribed)
|
||||
const sub = new Redis(baseOpts);
|
||||
|
||||
client.on('error', (e) => console.error('[redis] client error', e.message));
|
||||
sub.on('error', (e) => console.error('[redis] sub error', e.message));
|
||||
|
||||
export { client as redis, sub as redisSub };
|
||||
Reference in New Issue
Block a user