Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jan 21, 2025
1 parent 33e7910 commit a74a9ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions src/lib/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check warning on line 49 in src/lib/redis.ts

View check run for this annotation

Codecov / codecov/patch

src/lib/redis.ts#L36-L49

Added lines #L36 - L49 were not covered by tests
} 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);
Expand Down

0 comments on commit a74a9ed

Please sign in to comment.