fix and update

This commit is contained in:
lendry
2026-06-29 15:02:01 +03:00
parent 0df7240dc8
commit 01e4917acf
10 changed files with 326 additions and 132 deletions

View File

@@ -1,9 +1,23 @@
import { Controller, Get } from '@nestjs/common';
import { Controller, Get, ServiceUnavailableException } from '@nestjs/common';
import { firstValueFrom } from 'rxjs';
import { CoreGrpcService } from '../core-grpc.service';
@Controller('health')
export class HealthController {
constructor(private readonly core: CoreGrpcService) {}
@Get()
check() {
return { status: 'ok', service: 'api-gateway' };
async check() {
try {
await firstValueFrom(this.core.settings.GetSetting({ key: 'PROJECT_NAME' }));
return { status: 'ok', service: 'api-gateway', grpc: 'ok' };
} catch {
throw new ServiceUnavailableException({
status: 'error',
service: 'api-gateway',
grpc: 'unavailable',
message: 'Не удалось связаться с sso-core по gRPC'
});
}
}
}