diff --git a/src/controllers/AuthRoleController.ts b/src/controllers/AuthRoleController.ts index 13f5ce04..a549dfb5 100644 --- a/src/controllers/AuthRoleController.ts +++ b/src/controllers/AuthRoleController.ts @@ -128,6 +128,7 @@ export class AuthRoleController extends Controller { redisClient = await this.redis.createClient({ host: REDIS_HOST, port: REDIS_PORT, + password: process.env.REDIS_PASSWORD, }); redisClient.del("role_" + posMaster.current_holderId, (err: Error) => { @@ -296,6 +297,7 @@ export class AuthRoleController extends Controller { redisClient = await this.redis.createClient({ host: REDIS_HOST, port: REDIS_PORT, + password: process.env.REDIS_PASSWORD, }); await redisClient.flushdb(function (err: any, succeeded: any) { diff --git a/src/controllers/OrganizationController.ts b/src/controllers/OrganizationController.ts index 8358313b..605b2fa5 100644 --- a/src/controllers/OrganizationController.ts +++ b/src/controllers/OrganizationController.ts @@ -8830,6 +8830,7 @@ export class OrganizationController extends Controller { const redisClient = redis.createClient({ host: process.env.REDIS_HOST || "localhost", port: parseInt(process.env.REDIS_PORT || "6379"), + password: process.env.REDIS_PASSWORD, }); const keysAsync = promisify(redisClient.keys).bind(redisClient); const delAsync = promisify(redisClient.del).bind(redisClient); diff --git a/src/controllers/PermissionController.ts b/src/controllers/PermissionController.ts index 44747b09..324a42b4 100644 --- a/src/controllers/PermissionController.ts +++ b/src/controllers/PermissionController.ts @@ -42,6 +42,7 @@ export class PermissionController extends Controller { redisClient = await this.redis.createClient({ host: REDIS_HOST, port: REDIS_PORT, + password: process.env.REDIS_PASSWORD, }); const getAsync = promisify(redisClient.get).bind(redisClient); @@ -293,6 +294,7 @@ export class PermissionController extends Controller { redisClient = await this.redis.createClient({ host: REDIS_HOST, port: REDIS_PORT, + password: process.env.REDIS_PASSWORD, }); const getAsync = promisify(redisClient.get).bind(redisClient); @@ -691,6 +693,7 @@ export class PermissionController extends Controller { redisClient = await this.redis.createClient({ host: REDIS_HOST, port: REDIS_PORT, + password: process.env.REDIS_PASSWORD, }); const getAsync = promisify(redisClient.get).bind(redisClient); @@ -807,6 +810,7 @@ export class PermissionController extends Controller { redisClient = await this.redis.createClient({ host: REDIS_HOST, port: REDIS_PORT, + password: process.env.REDIS_PASSWORD, }); const getAsync = promisify(redisClient.get).bind(redisClient); @@ -902,6 +906,7 @@ export class PermissionController extends Controller { redisClient = await this.redis.createClient({ host: REDIS_HOST, port: REDIS_PORT, + password: process.env.REDIS_PASSWORD, }); const getAsync = promisify(redisClient.get).bind(redisClient); @@ -1155,6 +1160,7 @@ export class PermissionController extends Controller { redisClient = await this.redis.createClient({ host: REDIS_HOST, port: REDIS_PORT, + password: process.env.REDIS_PASSWORD, }); const getAsync = promisify(redisClient.get).bind(redisClient); @@ -1413,6 +1419,7 @@ export class PermissionController extends Controller { redisClient = await this.redis.createClient({ host: REDIS_HOST, port: REDIS_PORT, + password: process.env.REDIS_PASSWORD, }); // const getAsync = promisify(redisClient.get).bind(redisClient); diff --git a/src/controllers/PosMasterActController.ts b/src/controllers/PosMasterActController.ts index fbc09201..9ccf1d9c 100644 --- a/src/controllers/PosMasterActController.ts +++ b/src/controllers/PosMasterActController.ts @@ -328,6 +328,7 @@ export class PosMasterActController extends Controller { const redisClient = await this.redis.createClient({ host: REDIS_HOST, port: REDIS_PORT, + password: process.env.REDIS_PASSWORD, }); const delAsync = promisify(redisClient.del).bind(redisClient); @@ -865,6 +866,7 @@ export class PosMasterActController extends Controller { const redisClient = await this.redis.createClient({ host: REDIS_HOST, port: REDIS_PORT, + password: process.env.REDIS_PASSWORD, }); const delAsync = promisify(redisClient.del).bind(redisClient); diff --git a/src/interfaces/extension.ts b/src/interfaces/extension.ts index 405ed849..a2a55256 100644 --- a/src/interfaces/extension.ts +++ b/src/interfaces/extension.ts @@ -384,6 +384,7 @@ class Extension { const redisClient = redis.createClient({ host: REDIS_HOST, port: REDIS_PORT, + password: process.env.REDIS_PASSWORD, }); const delAsync = promisify(redisClient.del).bind(redisClient); const deleteKey = delAsync(type + id); diff --git a/src/interfaces/permission.ts b/src/interfaces/permission.ts index 5d22d274..aa1903ec 100644 --- a/src/interfaces/permission.ts +++ b/src/interfaces/permission.ts @@ -217,17 +217,20 @@ class CheckAuth { // Create Redis client const redisClient = this.redis.createClient({ - socket: { - host: REDIS_HOST, - port: REDIS_PORT, - }, + // socket: { + // host: REDIS_HOST, + // port: REDIS_PORT, + // }, + host: REDIS_HOST, + port: REDIS_PORT, + password: process.env.REDIS_PASSWORD, }); redisClient.on("error", (err: any) => { console.error("[REDIS] Connection error:", err.message); }); - await redisClient.connect(); + // await redisClient.connect(); console.log("[REDIS] Connected successfully!"); const getAsync = promisify(redisClient.get).bind(redisClient); diff --git a/src/services/ExecuteOrgCommandService.ts b/src/services/ExecuteOrgCommandService.ts index 62ed231f..31a7d317 100644 --- a/src/services/ExecuteOrgCommandService.ts +++ b/src/services/ExecuteOrgCommandService.ts @@ -844,6 +844,7 @@ export class ExecuteOrgCommandService { const redisClient = await redis.createClient({ host: REDIS_HOST, port: REDIS_PORT, + password: process.env.REDIS_PASSWORD, }); const delAsync = promisify(redisClient.del).bind(redisClient); diff --git a/src/services/rabbitmq.ts b/src/services/rabbitmq.ts index 227c431c..b4e81c41 100644 --- a/src/services/rabbitmq.ts +++ b/src/services/rabbitmq.ts @@ -1987,6 +1987,7 @@ async function clearMenuAndRoleCache(): Promise { const redisClient = redis.createClient({ host: REDIS_HOST, port: REDIS_PORT, + password: process.env.REDIS_PASSWORD, }); const keysAsync = promisify(redisClient.keys).bind(redisClient);