chore: add emqx_release:edition_longstr()
This commit is contained in:
parent
d73f22181d
commit
499da1ebe0
|
@ -18,6 +18,7 @@
|
|||
|
||||
-export([
|
||||
edition/0,
|
||||
edition_longstr/0,
|
||||
description/0,
|
||||
version/0
|
||||
]).
|
||||
|
@ -44,8 +45,12 @@ description() ->
|
|||
-spec edition() -> ce | ee.
|
||||
-ifdef(EMQX_RELEASE_EDITION).
|
||||
edition() -> ?EMQX_RELEASE_EDITION.
|
||||
|
||||
edition_longstr() -> <<"Enterprise">>.
|
||||
-else.
|
||||
edition() -> ce.
|
||||
|
||||
edition_longstr() -> <<"Opensource">>.
|
||||
-endif.
|
||||
|
||||
%% @doc Return the release version.
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
-include("emqx_mgmt.hrl").
|
||||
-elvis([{elvis_style, invalid_dynamic_call, disable}]).
|
||||
-elvis([{elvis_style, god_modules, disable}]).
|
||||
-dialyzer({nowarn_function, edition/0}).
|
||||
|
||||
-include_lib("stdlib/include/qlc.hrl").
|
||||
-include_lib("emqx/include/emqx.hrl").
|
||||
|
@ -142,7 +141,7 @@ node_info() ->
|
|||
node_status => 'running',
|
||||
uptime => proplists:get_value(uptime, BrokerInfo),
|
||||
version => iolist_to_binary(proplists:get_value(version, BrokerInfo)),
|
||||
edition => edition(),
|
||||
edition => emqx_release:edition_longstr(),
|
||||
role => mria_rlog:role()
|
||||
}.
|
||||
|
||||
|
@ -555,9 +554,3 @@ max_row_limit() ->
|
|||
?MAX_ROW_LIMIT.
|
||||
|
||||
table_size(Tab) -> ets:info(Tab, size).
|
||||
|
||||
edition() ->
|
||||
case emqx_release:edition() of
|
||||
ee -> <<"enterprise">>;
|
||||
ce -> <<"opensource">>
|
||||
end.
|
||||
|
|
|
@ -219,8 +219,8 @@ fields(node_info) ->
|
|||
)},
|
||||
{edition,
|
||||
mk(
|
||||
enum([opensource, enterprise]),
|
||||
#{desc => <<"Release edition">>, example => "opensource"}
|
||||
enum(['Opensource', 'Enterprise']),
|
||||
#{desc => <<"Release edition">>, example => "Opensource"}
|
||||
)},
|
||||
{sys_path,
|
||||
mk(
|
||||
|
|
|
@ -58,10 +58,7 @@ t_nodes_api(_) ->
|
|||
Node = binary_to_atom(maps:get(<<"node">>, LocalNodeInfo), utf8),
|
||||
?assertEqual(Node, node()),
|
||||
Edition = maps:get(<<"edition">>, LocalNodeInfo),
|
||||
case emqx_release:edition() of
|
||||
ee -> ?assertEqual(<<"enterprise">>, Edition);
|
||||
ce -> ?assertEqual(<<"opensource">>, Edition)
|
||||
end,
|
||||
?assertEqual(emqx_release:edition_longstr(), Edition),
|
||||
|
||||
NodePath = emqx_mgmt_api_test_util:api_path(["nodes", atom_to_list(node())]),
|
||||
{ok, NodeInfo} = emqx_mgmt_api_test_util:request_api(get, NodePath),
|
||||
|
|
Loading…
Reference in New Issue