-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correct the use of the redis health indicator
- Loading branch information
Showing
6 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
lib/redis.health.ts → lib/indicator/redis-health.indicator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { TerminusModule } from '@nestjs/terminus'; | ||
//import { HttpModule } from '@nestjs/axios'; | ||
import { RedisHealthIndicator } from './redis-health.indicator'; | ||
import { redisHealthIndicatorProvider } from './redis-health.provider'; | ||
|
||
@Module({ | ||
imports: [TerminusModule], | ||
providers: [ | ||
RedisHealthIndicator, | ||
redisHealthIndicatorProvider, | ||
], | ||
exports: [RedisHealthIndicator] | ||
}) | ||
export class RedisHealthModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Redis from 'ioredis'; | ||
import { REDIS_HEALTH_INDICATOR } from '../redis.constants'; | ||
|
||
export const redisHealthIndicatorProvider = { | ||
provide: REDIS_HEALTH_INDICATOR, | ||
useFactory: () => new Redis(), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export const REDIS_MODULE_CONNECTION = 'default'; | ||
export const REDIS_MODULE_CONNECTION_TOKEN = 'IORedisModuleConnectionToken'; | ||
export const REDIS_MODULE_OPTIONS_TOKEN = 'IORedisModuleOptionsToken'; | ||
|
||
export const REDIS_HEALTH_INDICATOR = 'redisHealthIndicator'; |