Merge branch 'improveHealth' into 'main'
extract health to module See merge request v3/service/user!31
This commit is contained in:
commit
30b5f8389e
|
@ -3,6 +3,7 @@ import { AutomapperModule } from '@automapper/nestjs';
|
|||
import { Module } from '@nestjs/common';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { ConfigurationModule } from './modules/configuration/configuration.module';
|
||||
import { HealthModule } from './modules/health/health.module';
|
||||
import { UsersModule } from './modules/users/users.module';
|
||||
|
||||
@Module({
|
||||
|
@ -11,6 +12,7 @@ import { UsersModule } from './modules/users/users.module';
|
|||
AutomapperModule.forRoot({ strategyInitializer: classes() }),
|
||||
UsersModule,
|
||||
ConfigurationModule,
|
||||
HealthModule,
|
||||
],
|
||||
controllers: [],
|
||||
providers: [],
|
||||
|
|
10
src/main.ts
10
src/main.ts
|
@ -9,11 +9,11 @@ async function bootstrap() {
|
|||
{
|
||||
transport: Transport.GRPC,
|
||||
options: {
|
||||
package: 'user',
|
||||
protoPath: join(
|
||||
__dirname,
|
||||
'modules/users/adapters/primaries/user.proto',
|
||||
),
|
||||
package: ['user', 'health'],
|
||||
protoPath: [
|
||||
join(__dirname, 'modules/users/adapters/primaries/user.proto'),
|
||||
join(__dirname, 'modules/health/adapters/primaries/health.proto'),
|
||||
],
|
||||
url: process.env.SERVICE_URL + ':' + process.env.SERVICE_PORT,
|
||||
loader: { keepCase: true },
|
||||
},
|
||||
|
|
|
@ -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 {}
|
|
@ -33,20 +33,3 @@ message Users {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import { ConfigModule, ConfigService } from '@nestjs/config';
|
|||
import { CqrsModule } from '@nestjs/cqrs';
|
||||
import { redisStore } from 'cache-manager-ioredis-yet';
|
||||
import { DatabaseModule } from '../database/database.module';
|
||||
import { HealthController } from './adapters/primaries/health.controller';
|
||||
import { UsersController } from './adapters/primaries/users.controller';
|
||||
import { Messager } from './adapters/secondaries/messager';
|
||||
import { UsersRepository } from './adapters/secondaries/users.repository';
|
||||
|
@ -47,7 +46,7 @@ import { UserProfile } from './mappers/user.profile';
|
|||
inject: [ConfigService],
|
||||
}),
|
||||
],
|
||||
controllers: [UsersController, HealthController],
|
||||
controllers: [UsersController],
|
||||
providers: [
|
||||
UserProfile,
|
||||
UsersRepository,
|
||||
|
|
Loading…
Reference in New Issue