Commits

Anonymous committed 60f03d2

Allow the username and password to be changed through configuration

Comments (0)

Files changed (1)

src/bql_amqp_rpc_server.erl

     gen_server:start_link(?MODULE, [], []).
 
 init([]) ->
-    Connection = amqp_connection:start_direct(#amqp_params{}),
+    User = case application:get_env(rabbitmq_bql, user) of
+      undefined -> <<"guest">>;
+      {ok, U} -> list_to_binary(U)
+    end,
+    Password = case application:get_env(rabbitmq_bql, password) of
+      undefined -> <<"guest">>;
+      {ok, P} -> list_to_binary(P)
+    end,
+
+    Connection = amqp_connection:start_direct(#amqp_params{username = User, password = Password}),
     Ch = amqp_connection:open_channel(Connection),
     link(Ch),