health check

This commit is contained in:
hannathkadher
2025-04-23 17:31:16 +04:00
parent cb2056d1b3
commit 0749fab633
3 changed files with 77 additions and 64 deletions

View File

@ -1,4 +1,5 @@
import { Controller, Get } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import {
HealthCheck,
HealthCheckService,
@ -8,6 +9,7 @@ import {
HttpHealthIndicator,
} from '@nestjs/terminus';
@ApiTags('Health Module')
@Controller('health')
export class HealthController {
constructor(
@ -29,7 +31,7 @@ export class HealthController {
path: '/',
}),
() => this.memory.checkHeap('memory_heap', 300 * 1024 * 1024),
() => this.http.pingCheck('tuya', 'https://openapi.tuya.com'),
() => this.http.pingCheck('tuya', process.env.TUYA_EU_URL),
]);
}
}

View File

@ -3,9 +3,9 @@ import { Module } from '@nestjs/common';
import { TerminusModule } from '@nestjs/terminus';
import { TypeOrmModule } from '@nestjs/typeorm';
import { HealthController } from './controllers';
import { HttpModule } from '@nestjs/axios';
@Module({
imports: [TerminusModule, TypeOrmModule],
imports: [TerminusModule, HttpModule, TypeOrmModule],
controllers: [HealthController],
})
export class HealthModule {}