Updating Go impl to use amqp uri from env
This commit is contained in:
parent
13d3d28fe3
commit
148cf7ef95
@ -10,7 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
connection, err := amqp.Dial("amqp://guest:guest@localhost:5672")
|
connection, err := amqp.Dial(sylvilagus.AMQP_URI)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Failed to connect!: ", err)
|
log.Fatal("Failed to connect!: ", err)
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ func main() {
|
|||||||
|
|
||||||
msgBody := string(os.Args[1])
|
msgBody := string(os.Args[1])
|
||||||
|
|
||||||
connection, err := amqp.Dial("amqp://guest:guest@localhost:5672")
|
connection, err := amqp.Dial(sylvilagus.AMQP_URI)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Failed to connect!: ", err)
|
log.Fatal("Failed to connect!: ", err)
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,21 @@ package sylvilagus
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/streadway/amqp"
|
"github.com/streadway/amqp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var AMQP_URI = os.Getenv("SYLVILAGUS_AMQP_URI")
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
if len(AMQP_URI) < 1 {
|
||||||
|
log.Fatal("SYLVILAGUS_AMQP_URI is not defined!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func CreateHelloTopology(connection *amqp.Connection) (*amqp.Channel, error) {
|
func CreateHelloTopology(connection *amqp.Connection) (*amqp.Channel, error) {
|
||||||
channel, err := connection.Channel()
|
channel, err := connection.Channel()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user