Skip to content

Commit 54d558c

Browse files
committed
WIP
1 parent d3ad28a commit 54d558c

File tree

2 files changed

+35
-9
lines changed

2 files changed

+35
-9
lines changed

priv/schema/rabbit.schema

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
% vim:ft=erlang:
12
% ==============================
23
% Rabbit app section
34
% ==============================
@@ -1110,6 +1111,23 @@ end}.
11101111
{validators, ["non_zero_positive_integer"]}
11111112
]}.
11121113

1114+
%% Product name & version overrides.
1115+
1116+
{mapping, "product.name", "rabbit.product_name", [
1117+
{datatype, string}
1118+
]}.
1119+
{mapping, "product.version", "rabbit.product_version", [
1120+
{datatype, string}
1121+
]}.
1122+
1123+
%% Message of the day file.
1124+
%% The content of that file is added to the banners, both logged and
1125+
%% printed.
1126+
1127+
{mapping, "motd_file", "rabbit.motd_file", [
1128+
{datatype, string}
1129+
]}.
1130+
11131131
% ==========================
11141132
% Lager section
11151133
% ==========================

src/rabbit.erl

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,8 @@ run_prelaunch_second_phase() ->
380380
start_it(StartType) ->
381381
case spawn_boot_marker() of
382382
{ok, Marker} ->
383-
Product = product_name(),
384383
T0 = erlang:timestamp(),
385-
rabbit_log:info("~s is asked to start...", [Product]),
384+
rabbit_log:info("RabbitMQ is asked to start..."),
386385
try
387386
{ok, _} = application:ensure_all_started(rabbitmq_prelaunch,
388387
StartType),
@@ -392,8 +391,8 @@ start_it(StartType) ->
392391

393392
T1 = erlang:timestamp(),
394393
rabbit_log_prelaunch:debug(
395-
"Time to start ~s: ~p µs",
396-
[Product, timer:now_diff(T1, T0)]),
394+
"Time to start RabbitMQ: ~p µs",
395+
[timer:now_diff(T1, T0)]),
397396
stop_boot_marker(Marker),
398397
ok
399398
catch
@@ -1311,7 +1310,6 @@ product_info() ->
13111310
#{name => NameFromEnv,
13121311
version => VersionFromEnv};
13131312
true ->
1314-
_ = application:load(rabbit),
13151313
Name = case NameFromEnv of
13161314
undefined ->
13171315
string_from_app_env(
@@ -1363,12 +1361,22 @@ base_product_version() ->
13631361
rabbit_misc:version().
13641362

13651363
motd_file() ->
1366-
case rabbit_env:get_context() of
1367-
#{motd_file := File} ->
1364+
%% Precendence is:
1365+
%% 1. The environment variable;
1366+
%% 2. The `motd_file` configuration parameter;
1367+
%% 3. The default value.
1368+
Context = rabbit_env:get_context(),
1369+
case Context of
1370+
#{motd_file := File,
1371+
var_origins := #{motd_file := environment}}
1372+
when File =/= undefined ->
13681373
File;
13691374
_ ->
1370-
_ = application:load(rabbit),
1371-
string_from_app_env(motd_file, undefined)
1375+
Default = case Context of
1376+
#{motd_file := File} -> File;
1377+
_ -> undefined
1378+
end,
1379+
string_from_app_env(motd_file, Default)
13721380
end.
13731381

13741382
motd() ->

0 commit comments

Comments
 (0)