File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 11var container = require ( 'rhea' ) // https://github.com/amqp/rhea
22var fs = require ( 'fs' ) ;
33var path = require ( 'path' ) ;
4+ var connectionOptions = getConnectionOptions ( )
45
56function getAmqpConnectionOptions ( ) {
67 return {
@@ -23,12 +24,14 @@ function getAmqpsConnectionOptions() {
2324 options [ 'key' ] = fs . readFileSync ( path . resolve ( certsLocation , 'client_rabbitmq_key.pem' ) )
2425 options [ 'cert' ] = fs . readFileSync ( path . resolve ( certsLocation , 'client_rabbitmq_certificate.pem' ) )
2526 options [ 'ca' ] = fs . readFileSync ( path . resolve ( certsLocation , 'ca_rabbitmq_certificate.pem' ) )
27+ return options
2628}
2729function getConnectionOptions ( ) {
28- switch ( process . env . RABBITMQ_AMQP_SCHEME || 'amqp' ) {
29- case 'amqp' :
30+ let scheme = process . env . RABBITMQ_AMQP_SCHEME || 'amqp'
31+ switch ( scheme ) {
32+ case "amqp" :
3033 return getAmqpConnectionOptions ( )
31- case ' amqps' :
34+ case " amqps" :
3235 return getAmqpsConnectionOptions ( )
3336 }
3437}
@@ -40,7 +43,7 @@ module.exports = {
4043 resolve ( )
4144 } )
4245 } )
43- let connection = container . connect ( getConnectionOptions ( ) )
46+ let connection = container . connect ( connectionOptions )
4447 let receiver = connection . open_receiver ( {
4548 source : 'my-queue' ,
4649 target : 'receiver-target' ,
You can’t perform that action at this time.
0 commit comments