added password to redis
This commit is contained in:
@@ -5,10 +5,16 @@ import { updateRoomOccupancyListener } from "../core/analyze.js";
|
|||||||
let redisClient: RedisClientType;
|
let redisClient: RedisClientType;
|
||||||
let subRedisClient: RedisClientType;
|
let subRedisClient: RedisClientType;
|
||||||
|
|
||||||
|
const redisOptions = {
|
||||||
|
socket: {
|
||||||
|
host: config.redis.host,
|
||||||
|
port: config.redis.port,
|
||||||
|
},
|
||||||
|
password: config.redis.password,
|
||||||
|
};
|
||||||
|
|
||||||
export async function initSubRedis(): Promise<void> {
|
export async function initSubRedis(): Promise<void> {
|
||||||
subRedisClient = createClient({
|
subRedisClient = createClient(redisOptions);
|
||||||
url: `redis://${config.redis.host}:${config.redis.port}`,
|
|
||||||
});
|
|
||||||
|
|
||||||
subRedisClient.on("error", (err) => {
|
subRedisClient.on("error", (err) => {
|
||||||
console.log("[Redis] SubRedis error:", err.message);
|
console.log("[Redis] SubRedis error:", err.message);
|
||||||
@@ -24,9 +30,7 @@ export async function initSubRedis(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function initRedis(): Promise<RedisClientType> {
|
export async function initRedis(): Promise<RedisClientType> {
|
||||||
redisClient = createClient({
|
redisClient = createClient(redisOptions);
|
||||||
url: `redis://${config.redis.host}:${config.redis.port}`,
|
|
||||||
});
|
|
||||||
|
|
||||||
redisClient.on("error", (err) => {
|
redisClient.on("error", (err) => {
|
||||||
console.log("[Redis] Redis error:", err.message);
|
console.log("[Redis] Redis error:", err.message);
|
||||||
|
|||||||
Reference in New Issue
Block a user