From 82ae2d3b024836e51e579c58173ee5085410ab9f Mon Sep 17 00:00:00 2001 From: juandav Date: Sat, 24 Feb 2024 07:58:13 -0500 Subject: [PATCH 1/2] fix: bugfix health provider --- lib/index.ts | 4 ++++ lib/indicator/redis-health.provider.ts | 11 ++++++++--- lib/redis.constants.ts | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index 671f86f..7b89409 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,6 +1,10 @@ +// Redis Module export * from './redis.module'; export * from './redis.decorators'; export * from './redis.interfaces'; export * from './redis.utils'; + +// Health Indicator +export * from './indicator/redis-health.provider'; export * from './indicator/redis-health.indicator'; export * from './indicator/redis-health.module'; diff --git a/lib/indicator/redis-health.provider.ts b/lib/indicator/redis-health.provider.ts index 22b61d3..d7366a6 100644 --- a/lib/indicator/redis-health.provider.ts +++ b/lib/indicator/redis-health.provider.ts @@ -1,7 +1,12 @@ -import Redis from 'ioredis'; -import { REDIS_HEALTH_INDICATOR } from '../redis.constants'; +import Redis, { RedisOptions } from 'ioredis'; +import { REDIS_HEALTH_INDICATOR, REDIS_CONFIG_OPTIONS } from '../redis.constants'; export const redisHealthIndicatorProvider = { provide: REDIS_HEALTH_INDICATOR, - useFactory: () => new Redis(), + useFactory: ( + redisConfigOrConnection: RedisOptions | Redis + ) => redisConfigOrConnection instanceof Redis + ? redisConfigOrConnection + : new Redis(redisConfigOrConnection), + inject: [REDIS_CONFIG_OPTIONS], }; diff --git a/lib/redis.constants.ts b/lib/redis.constants.ts index b25d282..7d2e23b 100644 --- a/lib/redis.constants.ts +++ b/lib/redis.constants.ts @@ -3,3 +3,4 @@ export const REDIS_MODULE_CONNECTION_TOKEN = 'IORedisModuleConnectionToken'; export const REDIS_MODULE_OPTIONS_TOKEN = 'IORedisModuleOptionsToken'; export const REDIS_HEALTH_INDICATOR = 'redisHealthIndicator'; +export const REDIS_CONFIG_OPTIONS = 'RedisConfigOptions'; From 9f25df6250dae1abb1606336af0de171a74a774a Mon Sep 17 00:00:00 2001 From: juandav Date: Sat, 24 Feb 2024 08:03:18 -0500 Subject: [PATCH 2/2] chore(release): 2.0.2 --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 951ccb3..366782f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [2.0.2](https://github.com/nest-modules/ioredis/compare/v2.0.1...v2.0.2) (2024-02-24) + + +### Bug Fixes + +* bugfix health provider ([82ae2d3](https://github.com/nest-modules/ioredis/commit/82ae2d3b024836e51e579c58173ee5085410ab9f)) + ### [2.0.1](https://github.com/nest-modules/ioredis/compare/v2.0.0...v2.0.1) (2023-12-22) diff --git a/package.json b/package.json index 1c2a9e2..d45a7db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nestjs-modules/ioredis", - "version": "2.0.1", + "version": "2.0.2", "description": "Nest - a ioredis module (@ioredis)", "author": "Nest Modules TM", "private": false,