File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change 11import { RabbitMQModule } from '@golevelup/nestjs-rabbitmq' ;
22import { CacheModule , forwardRef , Module } from '@nestjs/common' ;
3+ import { ConfigModule , ConfigService } from '@nestjs/config' ;
34import { TypeOrmModule } from '@nestjs/typeorm' ;
45import { UsersModule } from 'src/users/users.module' ;
56import { BenchmarkModule } from '../benchmarks/benchmark.module' ;
@@ -12,14 +13,20 @@ import { SubmissionsService } from './submissions.service';
1213 TypeOrmModule . forFeature ( [ Submission ] ) ,
1314 forwardRef ( ( ) => UsersModule ) ,
1415 CacheModule . register ( ) ,
15- RabbitMQModule . forRoot ( RabbitMQModule , {
16- exchanges : [
17- {
18- name : 'jobs_ex' ,
19- type : 'direct' ,
20- } ,
21- ] ,
22- uri : process . env . RABBITMQ_URL || 'amqp://admin:admin@localhost:5672/' ,
16+ RabbitMQModule . forRootAsync ( RabbitMQModule , {
17+ imports : [ ConfigModule ] ,
18+ inject : [ ConfigService ] ,
19+ useFactory : async ( configService : ConfigService ) => ( {
20+ exchanges : [
21+ {
22+ name : 'jobs_ex' ,
23+ type : 'direct' ,
24+ } ,
25+ ] ,
26+ uri :
27+ configService . get < string > ( 'RABBITMQ_URL' ) ||
28+ 'amqp://admin:admin@localhost:5672/' ,
29+ } ) ,
2330 } ) ,
2431 forwardRef ( ( ) => BenchmarkModule ) ,
2532 ] ,
You can’t perform that action at this time.
0 commit comments