Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mdovhopo/nestjs-pubsub-health-check
Nest module, that checks health of PubSub module
https://github.com/mdovhopo/nestjs-pubsub-health-check
hacktoberfest nestjs
Last synced: 4 months ago
JSON representation
Nest module, that checks health of PubSub module
- Host: GitHub
- URL: https://github.com/mdovhopo/nestjs-pubsub-health-check
- Owner: mdovhopo
- License: mit
- Created: 2021-04-13T14:22:16.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-10-28T09:00:31.000Z (about 2 years ago)
- Last Synced: 2024-09-28T14:01:20.165Z (4 months ago)
- Topics: hacktoberfest, nestjs
- Language: TypeScript
- Homepage:
- Size: 637 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nestjs-pubsub-health-check
[![Deploy](https://github.com/mdovhopo/nestjs-pubsub-health-check/workflows/Deploy/badge.svg)](https://github.com/mdovhopo/nestjs-pubsub-health-check/actions)
[![Coverage Status](https://coveralls.io/repos/github/mdovhopo/nestjs-pubsub-health-check/badge.svg?branch=master)](https://coveralls.io/github/mdovhopo/nestjs-pubsub-health-check?branch=master)Nest module, that checks health of PubSub module
## How it works
Module uses @nestjs/terminus health-check, and this module intended to be used with it.
Module tries to check if topic exists (by calling `exists` function on each passed topic).
Also, you need to grant `roles/pubsub.viewer` role to your application, (or any role that contains this),
to access topic info.## Usage
Installation:
```sh
npm i nestjs-pubsub-health-check
``````js
@Module({
imports: [
PubSubHealthCheckModule.forRootAsync({
inject: [PubSubService],
useFactory: (ps: PubSubService) => ({
topics: [ps.topic],
timeout: 5000, // optional
healthCheckKey: 'pubsub' // optional
}),
),
SomeModule,
],
})
export class AppModule {}
```And in you HealthCheck module just call
```js
// this.health - HealthCheckService from @nestjs/termius
this.health.check([
async () => this.pubSubHealthCheckModule.pingCheck(),
]);
```Bootstrapped with: [create-ts-lib-gh](https://github.com/glebbash/create-ts-lib-gh)
This project is [Mit Licensed](LICENSE).