@@ -13,27 +13,32 @@ func Start() int {
1313 ctx , cancel := context .WithCancel (context .Background ())
1414 defer cancel ()
1515
16- conf := config .ReadConfig () //read configuration from file & env
16+ conf , err := config .ReadConfig () //read configuration from file & env
17+ if err != nil {
18+ log .Println ("error while reading configuration" )
19+ return 1
20+ }
21+
1722 //initialize publisher connection to the queue
1823 //this library assumes using one publisher and one consumer per application
1924 //https://github.com/wagslane/go-rabbitmq/issues/79
20- pub , err := publisher .NewPublisher (conf .QueueConfig ) //TODO pass logger here and add it to publisher options
25+ pub , err := publisher .NewPublisher (conf .Queue ) //TODO pass logger here and add it to publisher options
2126 if err != nil {
2227 log .Println ("error while starting publisher: " , err )
2328 return 1
2429 }
2530 defer publisher .ClosePublisher (pub )
2631 //initialize consumer connection to the queue
27- consumer , err := queue .NewConsumer (conf .QueueConfig ) //TODO pass logger here and add it to consumer options
32+ consumer , err := queue .NewConsumer (conf .Queue ) //TODO pass logger here and add it to consumer options
2833 if err != nil {
2934 log .Println ("error while connecting to the queue: " , err )
3035 return 1
3136 }
3237 defer queue .CloseConsumer (consumer )
3338
34- handl := handler .NewApiSpecDocHandler (pub , conf .QueueConfig )
39+ handl := handler .NewApiSpecDocHandler (pub , conf .Queue )
3540 listener := queue .NewListener ()
36- err = listener .Start (consumer , & conf .QueueConfig , handl )
41+ err = listener .Start (consumer , & conf .Queue , handl )
3742 if err != nil {
3843 log .Println ("error while listening queue " , err )
3944 return 1
0 commit comments