diff --git a/README.md b/README.md index 21c0d9d..0ff42d4 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Valkey / Redis client (support [redis protocol](https://redis.io/docs/latest/dev ## Install ```bash -npm i egg-redis +npm i @eggjs/redis ``` Valkey / Redis Plugin for egg, support egg application access to Valkey / Redis Service. diff --git a/src/lib/redis.ts b/src/lib/redis.ts index 3af4517..3393364 100644 --- a/src/lib/redis.ts +++ b/src/lib/redis.ts @@ -41,15 +41,17 @@ function createClient(options: RedisClusterOptions | RedisClientOptions, app: Eg `[@eggjs/redis] 'host: ${sentinel.host}', 'port: ${sentinel.port}' are required on config`); }); + const mask = config.password ? '***' : config.password; assert(config.name && config.password !== undefined && config.db !== undefined, - `[@eggjs/redis] 'name of master: ${config.name}', 'password: ${config.password}', 'db: ${config.db}' are required on config`); + `[@eggjs/redis] 'name of master: ${config.name}', 'password: ${mask}', 'db: ${config.db}' are required on config`); app.coreLogger.info('[@eggjs/redis] sentinel connecting start'); client = new RedisClass(config as any); } else { const config = options as RedisClientOptions; + const mask = config.password ? '***' : config.password; assert((config.host && config.port && config.password !== undefined && config.db !== undefined) || config.path, - `[@eggjs/redis] 'host: ${config.host}', 'port: ${config.port}', 'password: ${config.password}', 'db: ${config.db}' or 'path:${config.path}' are required on config`); + `[@eggjs/redis] 'host: ${config.host}', 'port: ${config.port}', 'password: ${mask}', 'db: ${config.db}' or 'path:${config.path}' are required on config`); if (config.host) { app.coreLogger.info('[@eggjs/redis] server connecting redis://:***@%s:%s/%s', config.host, config.port, config.db);