chore: apply suggestions from code review

Co-authored-by: Zaiming (Stone) Shi <zmstone@gmail.com>
This commit is contained in:
zhongwencool 2022-10-28 21:39:45 +08:00
parent d37ad38e7a
commit 93924f567f
4 changed files with 8 additions and 8 deletions

View File

@ -17,8 +17,7 @@
- Enhanced log security in ACL modules, sensitive data will be obscured. [#9242](https://github.com/emqx/emqx/pull/9242).
- Add `dashboard.bootstrap_users_file` configuration to bulk import default user&password when EMQX first starts [#9256](https://github.com/emqx/emqx/pull/9256).
- Add `dashboard.bootstrap_users_file` configuration to bulk import default administrative username and password when EMQX initializes the database [#9256](https://github.com/emqx/emqx/pull/9256).
## Bug fixes

View File

@ -17,7 +17,7 @@
- 增强 ACL 模块中的日志安全性,敏感数据将被模糊化。[#9242](https://github.com/emqx/emqx/pull/9242)。
- 增加 `dashboard.bootstrap_users_file` 配置,可以在EMQX第一次启动时批量导入默认的用户/密码 [#9256](https://github.com/emqx/emqx/pull/9256)。
- 增加 `dashboard.bootstrap_users_file` 配置,可以让 EMQX 初始化数据库时,从该文件批量导入一些控制台用户的用户名 / 密码 [#9256](https://github.com/emqx/emqx/pull/9256)。
## 修复

View File

@ -18,8 +18,9 @@ dashboard.default_user.login = admin
dashboard.default_user.password = public
## Initialize users file
## Is used to add an administrative user to Dashboard when emqx is first launched,
## the format is:
## Is used to add administrative dashboard users when EMQX is launched for the first time.
## This config will not take any effect once EMQX database is populated with the provided users.
## The file content format is as below:
## ```
##username1:password1
##username2:password2

View File

@ -23,7 +23,7 @@
-include("emqx_dashboard.hrl").
-include_lib("emqx/include/logger.hrl").
-define(DEFAULT_PASSWORD, <<"public">>).
-define(BOOTSTRAP_USER_TAG, <<"bootstrap user">>).
-define(BOOTSTRAP_USER_TAG, <<"bootstrapped">>).
-boot_mnesia({mnesia, [boot]}).
-copy_mnesia({mnesia, [copy]}).
@ -242,7 +242,7 @@ add_bootstrap_user(File, Dev, MP, Line) ->
case add_user(Username, Password, ?BOOTSTRAP_USER_TAG) of
ok ->
add_bootstrap_user(File, Dev, MP, Line + 1);
Reason ->
{error, Reason} ->
throw(#{file => File, line => Line, content => Bin, reason => Reason})
end;
_ ->
@ -254,7 +254,7 @@ add_bootstrap_user(File, Dev, MP, Line) ->
end;
eof ->
ok;
Error ->
{error, Error} ->
throw(#{file => File, line => Line, reason => Error})
end.