Skip to content

Commit 23d4c3d

Browse files
docs: minor text improvements
1 parent abea7a2 commit 23d4c3d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

content/microservices/basics.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -536,10 +536,9 @@ Once everything is set up, you can inject the `ClientProxy` as usual using the `
536536

537537
For more information, refer to Node’s [TLS documentation](https://nodejs.org/api/tls.html).
538538

539+
#### Dynamic configuration
539540

540-
#### Dynamic Configuration
541-
542-
In scenarios where the microservice needs to be configured using the `ConfigService`, but the injection context becomes available only after the microservice instance is created, the `AsyncMicroserviceOptions` provides a solution. This approach enables dynamic configuration of the microservice, ensuring seamless integration with the `ConfigService`.
541+
When a microservice needs to be configured using the `ConfigService` (from the `@nestjs/config` package), but the injection context is only available after the microservice instance is created, `AsyncMicroserviceOptions` offers a solution. This approach allows for dynamic configuration, ensuring smooth integration with the `ConfigService`.
543542

544543
```typescript
545544
import { ConfigService } from '@nestjs/config';
@@ -548,17 +547,17 @@ import { AppModule } from './app.module';
548547

549548
async function bootstrap() {
550549
const app = await NestFactory.createMicroservice<AsyncMicroserviceOptions>(
551-
AppModule,
550+
AppModule,
552551
{
553-
useFactory: (confService: ConfigService) => ({
552+
useFactory: (configService: ConfigService) => ({
554553
transport: Transport.TCP,
555554
options: {
556-
host: confService.get<string>('HOST'),
557-
port: confService.get<number>('PORT'),
555+
host: configService.get<string>('HOST'),
556+
port: configService.get<number>('PORT'),
558557
},
559558
}),
560559
inject: [ConfigService],
561-
}
560+
},
562561
);
563562

564563
await app.listen();

0 commit comments

Comments
 (0)