use better constants

This commit is contained in:
sbriat 2023-10-17 14:35:38 +02:00
parent 4be4c4cbeb
commit adfd07c7a0
2 changed files with 4 additions and 3 deletions

View File

@ -2,6 +2,7 @@
export const SERVICE_NAME = 'user'; export const SERVICE_NAME = 'user';
// grpc // grpc
export const GRPC_PACKAGE_NAME = 'user';
export const GRPC_SERVICE_NAME = 'UserService'; export const GRPC_SERVICE_NAME = 'UserService';
// configuration // configuration
@ -11,6 +12,6 @@ export const SERVICE_CONFIGURATION_PROPAGATE_QUEUE =
'user-configuration-propagate'; 'user-configuration-propagate';
// health // health
export const HEALTH_SERVICE_NAME = 'health'; export const GRPC_HEALTH_PACKAGE_NAME = 'health';
export const HEALTH_USER_REPOSITORY = 'UserRepository'; export const HEALTH_USER_REPOSITORY = 'UserRepository';
export const HEALTH_CRITICAL_LOGGING_KEY = 'logging.user.health.crit'; export const HEALTH_CRITICAL_LOGGING_KEY = 'logging.user.health.crit';

View File

@ -2,7 +2,7 @@ import { NestFactory } from '@nestjs/core';
import { MicroserviceOptions, Transport } from '@nestjs/microservices'; import { MicroserviceOptions, Transport } from '@nestjs/microservices';
import { join } from 'path'; import { join } from 'path';
import { AppModule } from './app.module'; import { AppModule } from './app.module';
import { HEALTH_SERVICE_NAME, SERVICE_NAME } from './app.constants'; import { GRPC_HEALTH_PACKAGE_NAME, GRPC_PACKAGE_NAME } from './app.constants';
async function bootstrap() { async function bootstrap() {
const app = await NestFactory.create(AppModule); const app = await NestFactory.create(AppModule);
@ -12,7 +12,7 @@ async function bootstrap() {
app.connectMicroservice<MicroserviceOptions>({ app.connectMicroservice<MicroserviceOptions>({
transport: Transport.GRPC, transport: Transport.GRPC,
options: { options: {
package: [SERVICE_NAME, HEALTH_SERVICE_NAME], package: [GRPC_PACKAGE_NAME, GRPC_HEALTH_PACKAGE_NAME],
protoPath: [ protoPath: [
join(__dirname, 'modules/user/interface/grpc-controllers/user.proto'), join(__dirname, 'modules/user/interface/grpc-controllers/user.proto'),
join(__dirname, 'health.proto'), join(__dirname, 'health.proto'),