1
0
mirror of https://github.com/ebosas/microservices.git synced 2025-02-22 18:41:59 +02:00

Avoid a TLS error

This commit is contained in:
ebosas 2021-10-27 09:33:22 +03:00
parent df8b7ad56f
commit e4edb761d1

View File

@ -1,6 +1,10 @@
package rabbit
import "github.com/streadway/amqp"
import (
"crypto/tls"
"github.com/streadway/amqp"
)
// Conn returns a Rabbit connecton. Also, a channel to be used
// in the main go routine.
@ -11,7 +15,10 @@ type Conn struct {
// GetConn established a Rabbit connection.
func GetConn(rabbitURL string) (*Conn, error) {
conn, err := amqp.Dial(rabbitURL)
cfg := new(tls.Config)
cfg.InsecureSkipVerify = true // avoid error 'certificate signed by unknown authority'
conn, err := amqp.DialTLS(rabbitURL, cfg)
if err != nil {
return &Conn{}, err
}