chore(build): Single source of EMQX_DESCRIPTION
This commit is contained in:
parent
d14b90ef2e
commit
e1979bf488
5
Makefile
5
Makefile
|
@ -53,11 +53,6 @@ coveralls: $(REBAR)
|
|||
|
||||
.PHONY: $(REL_PROFILES)
|
||||
$(REL_PROFILES:%=%): $(REBAR) get-dashboard
|
||||
ifneq ($(shell echo $(@) |grep edge),)
|
||||
@export EMQX_DESC="$${EMQX_DESC} Edge"
|
||||
else
|
||||
@export EMQX_DESC="$${EMQX_DESC} Broker"
|
||||
endif
|
||||
@$(REBAR) as $(@) release
|
||||
|
||||
## Not calling rebar3 clean because
|
||||
|
|
|
@ -16,7 +16,7 @@ RUNNER_USER="{{ runner_user }}"
|
|||
LIB_EKKA_DIR="${RUNNER_LIB_DIR}/ekka-$(grep ekka "${RUNNER_ROOT_DIR}/releases/RELEASES" | awk -F '\"' '{print $2}')"
|
||||
|
||||
EMQX_LICENSE_CONF=''
|
||||
EMQX_DESCRIPTION="{{ emqx_description }}"
|
||||
export EMQX_DESCRIPTION='{{ emqx_description }}'
|
||||
|
||||
## computed vars
|
||||
REL_NAME="emqx"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{application, emqx,
|
||||
[{id, "emqx"},
|
||||
{description, "EMQ X"},
|
||||
{vsn, "4.3.0"}, % strict semver, bump manually!
|
||||
{modules, []},
|
||||
{registered, []},
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
[{application, Name, Opts}] = CONFIG,
|
||||
Desc = case os:getenv("EMQX_DESC") of
|
||||
[_ | _] = D -> D;
|
||||
_ -> "EMQ X test"
|
||||
end,
|
||||
[{application, Name, [{description, Desc} | Opts]}].
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
-export([ start/2
|
||||
, stop/1
|
||||
, get_description/0
|
||||
, get_release/0
|
||||
]).
|
||||
|
||||
|
@ -59,8 +60,15 @@ print_banner() ->
|
|||
io:format("Starting ~s on node ~s~n", [?APP, node()]).
|
||||
|
||||
print_vsn() ->
|
||||
{ok, Descr} = application:get_key(description),
|
||||
io:format("~s ~s is running now!~n", [Descr, get_release()]).
|
||||
io:format("~s ~s is running now!~n", [get_description(), get_release()]).
|
||||
|
||||
get_description() ->
|
||||
{ok, Descr0} = application:get_key(?APP, description),
|
||||
case os:getenv("EMQX_DESCRIPTION") of
|
||||
false -> Descr0;
|
||||
"" -> Descr0;
|
||||
Str -> string:strip(Str, both, $\n)
|
||||
end.
|
||||
|
||||
-ifdef(TEST).
|
||||
%% When testing, the 'cover' compiler stripps aways compile info
|
||||
|
|
|
@ -85,13 +85,11 @@ stop() ->
|
|||
|
||||
%% @doc Get sys version
|
||||
-spec(version() -> string()).
|
||||
version() ->
|
||||
{ok, Version} = application:get_key(?APP, vsn), Version.
|
||||
version() -> emqx_app:get_release().
|
||||
|
||||
%% @doc Get sys description
|
||||
-spec(sysdescr() -> string()).
|
||||
sysdescr() ->
|
||||
{ok, Descr} = application:get_key(?APP, description), Descr.
|
||||
sysdescr() -> emqx_app:get_description().
|
||||
|
||||
%% @doc Get sys uptime
|
||||
-spec(uptime() -> string()).
|
||||
|
|
Loading…
Reference in New Issue