Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Load definitions from rabbitmq.load_definitions via a boot step
Browse files Browse the repository at this point in the history
Previously we tried to rely on rabbitmq_management env
being loaded in the core. That is suboptimal and has
unintentional side effects.

References rabbitmq/rabbitmq-management#2368, rabbitmq/rabbitmq-management#2373.
Closes #818.
  • Loading branch information
michaelklishin committed Jun 9, 2020
1 parent 14deeaa commit f5162db
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/rabbit_mgmt_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
-define(DEFAULT_PORT, 15672).
-define(DEFAULT_TLS_PORT, 15671).

-rabbit_boot_step({rabbit_management_load_definitions,
[{description, "Imports definition file at management.load_definitions"},
{mfa, {rabbit_mgmt_load_definitions, boot, []}},
{requires, empty_db_check}]}).

start(_Type, _StartArgs) ->
case application:get_env(rabbitmq_management_agent, disable_metrics_collector, false) of
false ->
Expand Down
9 changes: 8 additions & 1 deletion src/rabbit_mgmt_load_definitions.erl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@

-include_lib("rabbit_common/include/rabbit.hrl").

-export([maybe_load_definitions/0, maybe_load_definitions_from/2]).
-export([boot/0, maybe_load_definitions/0, maybe_load_definitions_from/2]).

%% This module exists for backwards compatibility only.
%% Definition import functionality is now a core server feature.

boot() ->
rabbit_log:debug("Will import definitions file from management.load_definitions"),
rabbit_definitions:maybe_load_definitions(rabbitmq_management, load_definitions).

maybe_load_definitions() ->
rabbit_definitions:maybe_load_definitions().
Expand Down

0 comments on commit f5162db

Please sign in to comment.