Commit f09631db authored by FORESTIER Fabien's avatar FORESTIER Fabien
Browse files

Add health module + update version to 1.2.0

parent 41acabeb
This diff is collapsed.
{
"name": "service-organizations",
"version": "1.1.0",
"version": "1.2.0",
"description": "description",
"author": "",
"license": "MIT",
......@@ -24,9 +24,11 @@
"typeorm:migrate-ci": "ts-node -r tsconfig-paths/register ./node_modules/.bin/typeorm migration:run"
},
"dependencies": {
"@godaddy/terminus": "^4.1.0",
"@nestjs/common": "^5.1.0",
"@nestjs/core": "^5.1.0",
"@nestjs/swagger": "^2.5.1",
"@nestjs/terminus": "^5.5.0",
"@nestjs/typeorm": "^5.2.2",
"@types/dotenv": "^4.0.3",
"amqplib": "^0.5.2",
......
......@@ -2,8 +2,14 @@ import { Module } from '@nestjs/common';
import { OrganizationsModule } from './organizations/organizations.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import { LinksModule } from './links/links.module';
import { HealthModule } from './health/health.module';
@Module({
imports: [TypeOrmModule.forRoot(), OrganizationsModule, LinksModule],
imports: [
TypeOrmModule.forRoot(),
OrganizationsModule,
LinksModule,
HealthModule,
],
})
export class AppModule { }
import {
TerminusEndpoint,
TerminusOptionsFactory,
TerminusModuleOptions,
DatabaseHealthIndicator,
} from '@nestjs/terminus';
import { Injectable } from '@nestjs/common';
@Injectable()
export class HealthCheckService implements TerminusOptionsFactory {
constructor(
private readonly _dbHealthIndicator: DatabaseHealthIndicator,
) { }
createTerminusOptions(): TerminusModuleOptions {
const healthEndpoint: TerminusEndpoint = {
url: '/health',
healthIndicators: [
async () => this._dbHealthIndicator.pingCheck('database', { timeout: 300 }),
],
};
return {
endpoints: [healthEndpoint],
};
}
}
\ No newline at end of file
import { Module } from '@nestjs/common';
import { TerminusModule } from '@nestjs/terminus';
import { HealthCheckService } from './health-check.service';
@Module({
imports: [
TerminusModule.forRootAsync({
useClass: HealthCheckService,
}),
],
})
export class HealthModule { }
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment