extract health to module
This commit is contained in:
parent
f08622ce35
commit
6a0b33f742
|
@ -4,6 +4,7 @@ import { Module } from '@nestjs/common';
|
||||||
import { ConfigModule } from '@nestjs/config';
|
import { ConfigModule } from '@nestjs/config';
|
||||||
import { AuthenticationModule } from './modules/authentication/authentication.module';
|
import { AuthenticationModule } from './modules/authentication/authentication.module';
|
||||||
import { AuthorizationModule } from './modules/authorization/authorization.module';
|
import { AuthorizationModule } from './modules/authorization/authorization.module';
|
||||||
|
import { HealthModule } from './modules/health/health.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -11,6 +12,7 @@ import { AuthorizationModule } from './modules/authorization/authorization.modul
|
||||||
AutomapperModule.forRoot({ strategyInitializer: classes() }),
|
AutomapperModule.forRoot({ strategyInitializer: classes() }),
|
||||||
AuthenticationModule,
|
AuthenticationModule,
|
||||||
AuthorizationModule,
|
AuthorizationModule,
|
||||||
|
HealthModule,
|
||||||
],
|
],
|
||||||
controllers: [],
|
controllers: [],
|
||||||
providers: [],
|
providers: [],
|
||||||
|
|
|
@ -9,7 +9,7 @@ async function bootstrap() {
|
||||||
{
|
{
|
||||||
transport: Transport.GRPC,
|
transport: Transport.GRPC,
|
||||||
options: {
|
options: {
|
||||||
package: ['authentication', 'authorization'],
|
package: ['authentication', 'authorization', 'health'],
|
||||||
protoPath: [
|
protoPath: [
|
||||||
join(
|
join(
|
||||||
__dirname,
|
__dirname,
|
||||||
|
@ -19,6 +19,7 @@ async function bootstrap() {
|
||||||
__dirname,
|
__dirname,
|
||||||
'modules/authorization/adapters/primaries/authorization.proto',
|
'modules/authorization/adapters/primaries/authorization.proto',
|
||||||
),
|
),
|
||||||
|
join(__dirname, 'modules/health/adapters/primaries/health.proto'),
|
||||||
],
|
],
|
||||||
url: process.env.SERVICE_URL + ':' + process.env.SERVICE_PORT,
|
url: process.env.SERVICE_URL + ':' + process.env.SERVICE_PORT,
|
||||||
loader: { keepCase: true, enums: String },
|
loader: { keepCase: true, enums: String },
|
||||||
|
|
|
@ -40,20 +40,3 @@ message Uuid {
|
||||||
}
|
}
|
||||||
|
|
||||||
message Empty {}
|
message Empty {}
|
||||||
|
|
||||||
service Health {
|
|
||||||
rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
message HealthCheckRequest {
|
|
||||||
string service = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message HealthCheckResponse {
|
|
||||||
enum ServingStatus {
|
|
||||||
UNKNOWN = 0;
|
|
||||||
SERVING = 1;
|
|
||||||
NOT_SERVING = 2;
|
|
||||||
}
|
|
||||||
ServingStatus status = 1;
|
|
||||||
}
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import { RabbitMQModule } from '@golevelup/nestjs-rabbitmq';
|
||||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||||
import { AuthenticationMessagerController } from './adapters/primaries/authentication-messager.controller';
|
import { AuthenticationMessagerController } from './adapters/primaries/authentication-messager.controller';
|
||||||
import { Messager } from './adapters/secondaries/messager';
|
import { Messager } from './adapters/secondaries/messager';
|
||||||
import { HealthController } from './adapters/primaries/health.controller';
|
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -48,11 +47,7 @@ import { HealthController } from './adapters/primaries/health.controller';
|
||||||
inject: [ConfigService],
|
inject: [ConfigService],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
controllers: [
|
controllers: [AuthenticationController, AuthenticationMessagerController],
|
||||||
AuthenticationController,
|
|
||||||
AuthenticationMessagerController,
|
|
||||||
HealthController,
|
|
||||||
],
|
|
||||||
providers: [
|
providers: [
|
||||||
AuthenticationProfile,
|
AuthenticationProfile,
|
||||||
UsernameProfile,
|
UsernameProfile,
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package health;
|
||||||
|
|
||||||
|
|
||||||
|
service Health {
|
||||||
|
rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
message HealthCheckRequest {
|
||||||
|
string service = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message HealthCheckResponse {
|
||||||
|
enum ServingStatus {
|
||||||
|
UNKNOWN = 0;
|
||||||
|
SERVING = 1;
|
||||||
|
NOT_SERVING = 2;
|
||||||
|
}
|
||||||
|
ServingStatus status = 1;
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { HealthController } from './adapters/primaries/health.controller';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
controllers: [HealthController],
|
||||||
|
})
|
||||||
|
export class HealthModule {}
|
Loading…
Reference in New Issue