mirror of
https://github.com/docmost/docmost.git
synced 2026-05-18 15:34:05 +08:00
23 lines
621 B
TypeScript
23 lines
621 B
TypeScript
import { Controller, Get } from '@nestjs/common';
|
|
import { HealthCheck, HealthCheckService } from '@nestjs/terminus';
|
|
import { PostgresHealthIndicator } from './postgres.health';
|
|
import { RedisHealthIndicator } from './redis.health';
|
|
|
|
@Controller('health')
|
|
export class HealthController {
|
|
constructor(
|
|
private health: HealthCheckService,
|
|
private postgres: PostgresHealthIndicator,
|
|
private redis: RedisHealthIndicator,
|
|
) {}
|
|
|
|
@Get()
|
|
@HealthCheck()
|
|
async check() {
|
|
return this.health.check([
|
|
() => this.postgres.pingCheck('database'),
|
|
() => this.redis.pingCheck('redis'),
|
|
]);
|
|
}
|
|
}
|