Skip to content

Commit

Permalink
Merge pull request cockroachdb#30 from crowdflux/himanshu-github
Browse files Browse the repository at this point in the history
adding rabbitmq configuration in config file
  • Loading branch information
himanshu144141 authored Oct 7, 2016
2 parents 0999b67 + d24257b commit 0395606
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
11 changes: 9 additions & 2 deletions app/DAL/clients/rabbitmq/rabbitmq.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package rabbitmq

import "github.com/streadway/amqp"
import (
"github.com/crowdflux/angel/app/config"
"github.com/streadway/amqp"
)

var rabbitmqConn *amqp.Connection

Expand All @@ -10,7 +13,11 @@ func init() {

func initRabbitMqClient() *amqp.Connection {

conn, err := amqp.Dial("amqp://guest:guest@localhost:5672/")
username := config.RABBITMQ_USERNAME.Get()
password := config.RABBITMQ_PASSWORD.Get()
host := config.RABBITMQ_HOST.Get()

conn, err := amqp.Dial("amqp://" + username + ":" + password + "@" + host + ":5672/")
if err != nil {
panic(err)
}
Expand Down
4 changes: 4 additions & 0 deletions app/config/config_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ const (
PLOG_LEVEL = configKey("plog.log_level")

NEW_RELIC_KEY = configKey("newrelic.key")

RABBITMQ_USERNAME = configKey("rabbitmq.username")
RABBITMQ_PASSWORD = configKey("rabbitmq.password")
RABBITMQ_HOST = configKey("rabbitmq.host")
)

// Gets the value for given key from the config file.
Expand Down
7 changes: 6 additions & 1 deletion app/config/development_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
"log_level" : "<log_level>"
},
"newrelic" : {
"key" : "<newrelic_licence_key>"
"key": "<newrelic_licence_key>"
},
"rabbitmq" : {
"username" : "guest",
"password" : "guest",
"host" : "localhost"
}
}

0 comments on commit 0395606

Please sign in to comment.