Skip to content

RabbitMQ: dynamic subscription, queue and decorator values #323

Answered by WonderPanda
nidomiro asked this question in Q&A
Discussion options

You must be logged in to vote

This is a major shortcoming of the NestJS configuration system and why I strongly suggest that configuration should occur separate from DI/Module initialization. The config package @golevelup/profiguration which I use for my own projects specifically gets bootstrapped at the start of your application before any imports are evaluated so you can actually use it to configure decorators.

The other option is to manually call dotenv.config at the top of your main entry point file at which point you should be able to reference process.env variables in your decorators

If you want to stick with your existing config system you can definitely manually set up subscriptions/rpc in module init. Just in…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@federicogatti
Comment options

@WonderPanda
Comment options

@simplenotezy
Comment options

Answer selected by WonderPanda
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants
Converted from issue

This discussion was converted from issue #322 on October 14, 2021 14:42.