Skip to content

Commit

Permalink
chore: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikaple authored May 17, 2021
1 parent 9ea3df1 commit b507254
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,9 @@ export class Config {
}
```

## Using config in decorators
## Using config outside Nest's IoC container (Usage in decorators)

> **CAUTION!** You can't use config in decorators through dependency injection, using it will make you struggle harder writing unit tests.
> **CAUTION!** Using config outside Nest's IoC container will make you struggle harder writing unit tests, you should avoid this pattern as much as possible.
Due to the nature of JavaScript loading modules, decorators are executed before Nest's module initialization. If you want to get config value in decorators like `@Controller()` or `@WebSocketGateway()`, config module should be initialized before application bootstrap.

Expand Down

0 comments on commit b507254

Please sign in to comment.