fix: build i18n conf with dashboard app

This commit is contained in:
DDDHuang 2022-04-25 19:57:40 +08:00
parent 57360de94d
commit 69f1a2ac86
4 changed files with 4 additions and 6 deletions

View File

@ -25,7 +25,6 @@
-import(hoconsc, [ -import(hoconsc, [
mk/2, mk/2,
% ref/2,
array/1, array/1,
enum/1 enum/1
]). ]).

View File

@ -31,8 +31,6 @@ admins(["add", Username, Password, Desc]) ->
case emqx_dashboard_admin:add_user(bin(Username), bin(Password), bin(Desc)) of case emqx_dashboard_admin:add_user(bin(Username), bin(Password), bin(Desc)) of
{ok, _} -> {ok, _} ->
emqx_ctl:print("ok~n"); emqx_ctl:print("ok~n");
{error, already_existed} ->
emqx_ctl:print("Error: already existed~n");
{error, Reason} -> {error, Reason} ->
emqx_ctl:print("Error: ~p~n", [Reason]) emqx_ctl:print("Error: ~p~n", [Reason])
end; end;

View File

@ -147,12 +147,14 @@ bind(desc) -> ?DESC(bind);
bind(_) -> undefined. bind(_) -> undefined.
default_username(type) -> binary(); default_username(type) -> binary();
default_username(default) -> "admin";
default_username(required) -> true; default_username(required) -> true;
default_username(desc) -> ?DESC(default_username); default_username(desc) -> ?DESC(default_username);
default_username('readOnly') -> true; default_username('readOnly') -> true;
default_username(_) -> undefined. default_username(_) -> undefined.
default_password(type) -> binary(); default_password(type) -> binary();
default_password(default) -> "public";
default_password(required) -> true; default_password(required) -> true;
default_password('readOnly') -> true; default_password('readOnly') -> true;
default_password(sensitive) -> true; default_password(sensitive) -> true;

View File

@ -3,8 +3,7 @@
-mode(compile). -mode(compile).
main(_) -> main(_) ->
{ok, BaseConf} = file:read_file("apps/emqx_dashboard/i18n/emqx_dashboard_i18n.conf"), BaseConf = <<"">>,
Cfgs = get_all_cfgs("apps/"), Cfgs = get_all_cfgs("apps/"),
Conf = [merge(BaseConf, Cfgs), Conf = [merge(BaseConf, Cfgs),
io_lib:nl() io_lib:nl()
@ -23,7 +22,7 @@ merge(BaseConf, Cfgs) ->
end, BaseConf, Cfgs). end, BaseConf, Cfgs).
get_all_cfgs(Root) -> get_all_cfgs(Root) ->
Apps = filelib:wildcard("*", Root) -- ["emqx_machine", "emqx_dashboard"], Apps = filelib:wildcard("*", Root) -- ["emqx_machine"],
Dirs = [filename:join([Root, App]) || App <- Apps], Dirs = [filename:join([Root, App]) || App <- Apps],
lists:foldl(fun get_cfgs/2, [], Dirs). lists:foldl(fun get_cfgs/2, [], Dirs).