chore(dashboard): change root name emqx_dashboard > dashboard

This commit is contained in:
JianBo He 2022-01-04 14:23:52 +08:00
parent 6bb919b65c
commit af2868e598
9 changed files with 11 additions and 11 deletions

View File

@ -79,7 +79,7 @@ set_special_configs(emqx_dashboard) ->
port => 18083 port => 18083
}] }]
}, },
emqx_config:put([emqx_dashboard], Config), emqx_config:put([dashboard], Config),
ok; ok;
set_special_configs(_App) -> set_special_configs(_App) ->
ok. ok.

View File

@ -2,7 +2,7 @@
## EMQ X Dashboard ## EMQ X Dashboard
##-------------------------------------------------------------------- ##--------------------------------------------------------------------
emqx_dashboard { dashboard {
default_username = "admin" default_username = "admin"
default_password = "public" default_password = "public"
## notice: sample_interval should be divisible by 60. ## notice: sample_interval should be divisible by 60.

View File

@ -90,7 +90,7 @@ listeners() ->
Name = listener_name(Protocol, Port), Name = listener_name(Protocol, Port),
RanchOptions = ranch_opts(maps:without([protocol], ListenerOptions)), RanchOptions = ranch_opts(maps:without([protocol], ListenerOptions)),
{Name, Protocol, Port, RanchOptions} {Name, Protocol, Port, RanchOptions}
end || ListenerOptions <- emqx_conf:get([emqx_dashboard, listeners], [])]. end || ListenerOptions <- emqx_conf:get([dashboard, listeners], [])].
ranch_opts(RanchOptions) -> ranch_opts(RanchOptions) ->
Keys = [ {ack_timeout, handshake_timeout} Keys = [ {ack_timeout, handshake_timeout}

View File

@ -229,7 +229,7 @@ add_default_user() ->
add_default_user(binenv(default_username), binenv(default_password)). add_default_user(binenv(default_username), binenv(default_password)).
binenv(Key) -> binenv(Key) ->
iolist_to_binary(emqx_conf:get([emqx_dashboard, Key], "")). iolist_to_binary(emqx_conf:get([dashboard, Key], "")).
add_default_user(Username, Password) when ?EMPTY_KEY(Username) orelse ?EMPTY_KEY(Password) -> add_default_user(Username, Password) when ?EMPTY_KEY(Username) orelse ?EMPTY_KEY(Password) ->
{ok, empty}; {ok, empty};

View File

@ -55,7 +55,7 @@ get_collect() -> gen_server:call(whereis(?MODULE), get_collect).
init([]) -> init([]) ->
timer(next_interval(), collect), timer(next_interval(), collect),
timer(get_today_remaining_seconds(), clear_expire_data), timer(get_today_remaining_seconds(), clear_expire_data),
ExpireInterval = emqx_conf:get([emqx_dashboard, monitor, interval], ?EXPIRE_INTERVAL), ExpireInterval = emqx_conf:get([dashboard, monitor, interval], ?EXPIRE_INTERVAL),
State = #{ State = #{
count => count(), count => count(),
expire_interval => ExpireInterval, expire_interval => ExpireInterval,
@ -75,7 +75,7 @@ next_interval() ->
(1000 * interval()) - (erlang:system_time(millisecond) rem (1000 * interval())) - 1. (1000 * interval()) - (erlang:system_time(millisecond) rem (1000 * interval())) - 1.
interval() -> interval() ->
emqx_conf:get([?APP, sample_interval], ?DEFAULT_INTERVAL). emqx_conf:get([dashboard, sample_interval], ?DEFAULT_INTERVAL).
count() -> count() ->
60 div interval(). 60 div interval().

View File

@ -21,7 +21,7 @@
-export([execute/2]). -export([execute/2]).
execute(Req, Env) -> execute(Req, Env) ->
CORS = emqx_conf:get([emqx_dashboard, cors], false), CORS = emqx_conf:get([dashboard, cors], false),
case CORS andalso cowboy_req:header(<<"origin">>, Req, undefined) of case CORS andalso cowboy_req:header(<<"origin">>, Req, undefined) of
false -> false ->
{ok, Req, Env}; {ok, Req, Env};

View File

@ -22,9 +22,9 @@
,namespace/0]). ,namespace/0]).
namespace() -> <<"dashboard">>. namespace() -> <<"dashboard">>.
roots() -> ["emqx_dashboard"]. roots() -> ["dashboard"].
fields("emqx_dashboard") -> fields("dashboard") ->
[ {listeners, hoconsc:array(hoconsc:union([hoconsc:ref(?MODULE, "http"), [ {listeners, hoconsc:array(hoconsc:union([hoconsc:ref(?MODULE, "http"),
hoconsc:ref(?MODULE, "https")]))} hoconsc:ref(?MODULE, "https")]))}
, {default_username, fun default_username/1} , {default_username, fun default_username/1}

View File

@ -163,7 +163,7 @@ jwt_expiration_time() ->
erlang:system_time(millisecond) + token_ttl(). erlang:system_time(millisecond) + token_ttl().
token_ttl() -> token_ttl() ->
emqx_conf:get([emqx_dashboard, token_expired_time], ?EXPTIME). emqx_conf:get([dashboard, token_expired_time], ?EXPTIME).
format(Token, Username, ExpTime) -> format(Token, Username, ExpTime) ->
#?ADMIN_JWT{ #?ADMIN_JWT{

View File

@ -94,7 +94,7 @@ set_special_configs(emqx_dashboard) ->
default_username => <<"admin">>, default_username => <<"admin">>,
default_password => <<"public">> default_password => <<"public">>
}, },
emqx_config:put([emqx_dashboard], Config), emqx_config:put([dashboard], Config),
ok; ok;
set_special_configs(_) -> set_special_configs(_) ->
ok. ok.