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 1
1
import { RabbitMQModule } from '@golevelup/nestjs-rabbitmq' ;
2
2
import { CacheModule , forwardRef , Module } from '@nestjs/common' ;
3
+ import { ConfigModule , ConfigService } from '@nestjs/config' ;
3
4
import { TypeOrmModule } from '@nestjs/typeorm' ;
4
5
import { UsersModule } from 'src/users/users.module' ;
5
6
import { BenchmarkModule } from '../benchmarks/benchmark.module' ;
@@ -12,14 +13,20 @@ import { SubmissionsService } from './submissions.service';
12
13
TypeOrmModule . forFeature ( [ Submission ] ) ,
13
14
forwardRef ( ( ) => UsersModule ) ,
14
15
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
+ } ) ,
23
30
} ) ,
24
31
forwardRef ( ( ) => BenchmarkModule ) ,
25
32
] ,
You can’t perform that action at this time.
0 commit comments