egg
egg copied to clipboard
egg-redis 无法使用path方式创建redis客户端
What happens?
egg-redis 在检查配置参数时如果没有host、port等配置会直接报错(代码),但实际上ioredis是可以通过path方式来创建redis客户端的:

最小可复现仓库
请使用
npm init egg --type=simple bug创建,并上传到你的 GitHub 仓库
复现步骤,错误日志以及相关配置
/Users/zhaozhiming/projects/xxx/node_modules/egg-redis/lib/redis.js:38
assert(config.host && config.port && config.password !== undefined && config.db !== undefined,
^
AssertionError [ERR_ASSERTION]: [egg-redis] 'host: ', 'port: 6379', 'password: ', 'db: 0' are required on config
配置信息
config.redis = {
client: {
path: '/my/sock/path',
db: 0,
},
};
相关环境信息
- 操作系统: linux ubuntu 18
- Node 版本: 13.14.0
- Egg 版本: 2.6.1