diff --git a/app/DAL/clients/rabbitmq/rabbitmq.go b/app/DAL/clients/rabbitmq/rabbitmq.go index 788de4ee79bc..1a8e5be78979 100644 --- a/app/DAL/clients/rabbitmq/rabbitmq.go +++ b/app/DAL/clients/rabbitmq/rabbitmq.go @@ -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 @@ -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) } diff --git a/app/config/config_keys.go b/app/config/config_keys.go index ce3520a38068..79ce3a55b5ea 100644 --- a/app/config/config_keys.go +++ b/app/config/config_keys.go @@ -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. diff --git a/app/config/development_example.json b/app/config/development_example.json index 4e8979063c39..fca534df8c2d 100644 --- a/app/config/development_example.json +++ b/app/config/development_example.json @@ -92,6 +92,11 @@ "log_level" : "" }, "newrelic" : { - "key" : "" + "key": "" + }, + "rabbitmq" : { + "username" : "guest", + "password" : "guest", + "host" : "localhost" } } \ No newline at end of file