chore: apply suggestions from code review
Co-authored-by: Zaiming (Stone) Shi <zmstone@gmail.com>
This commit is contained in:
parent
d37ad38e7a
commit
93924f567f
|
@ -17,8 +17,7 @@
|
||||||
|
|
||||||
- Enhanced log security in ACL modules, sensitive data will be obscured. [#9242](https://github.com/emqx/emqx/pull/9242).
|
- 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
|
## Bug fixes
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
- 增强 ACL 模块中的日志安全性,敏感数据将被模糊化。[#9242](https://github.com/emqx/emqx/pull/9242)。
|
- 增强 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)。
|
||||||
|
|
||||||
|
|
||||||
## 修复
|
## 修复
|
||||||
|
|
|
@ -18,8 +18,9 @@ dashboard.default_user.login = admin
|
||||||
dashboard.default_user.password = public
|
dashboard.default_user.password = public
|
||||||
|
|
||||||
## Initialize users file
|
## Initialize users file
|
||||||
## Is used to add an administrative user to Dashboard when emqx is first launched,
|
## Is used to add administrative dashboard users when EMQX is launched for the first time.
|
||||||
## the format is:
|
## 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
|
##username1:password1
|
||||||
##username2:password2
|
##username2:password2
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
-include("emqx_dashboard.hrl").
|
-include("emqx_dashboard.hrl").
|
||||||
-include_lib("emqx/include/logger.hrl").
|
-include_lib("emqx/include/logger.hrl").
|
||||||
-define(DEFAULT_PASSWORD, <<"public">>).
|
-define(DEFAULT_PASSWORD, <<"public">>).
|
||||||
-define(BOOTSTRAP_USER_TAG, <<"bootstrap user">>).
|
-define(BOOTSTRAP_USER_TAG, <<"bootstrapped">>).
|
||||||
|
|
||||||
-boot_mnesia({mnesia, [boot]}).
|
-boot_mnesia({mnesia, [boot]}).
|
||||||
-copy_mnesia({mnesia, [copy]}).
|
-copy_mnesia({mnesia, [copy]}).
|
||||||
|
@ -242,7 +242,7 @@ add_bootstrap_user(File, Dev, MP, Line) ->
|
||||||
case add_user(Username, Password, ?BOOTSTRAP_USER_TAG) of
|
case add_user(Username, Password, ?BOOTSTRAP_USER_TAG) of
|
||||||
ok ->
|
ok ->
|
||||||
add_bootstrap_user(File, Dev, MP, Line + 1);
|
add_bootstrap_user(File, Dev, MP, Line + 1);
|
||||||
Reason ->
|
{error, Reason} ->
|
||||||
throw(#{file => File, line => Line, content => Bin, reason => Reason})
|
throw(#{file => File, line => Line, content => Bin, reason => Reason})
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
|
@ -254,7 +254,7 @@ add_bootstrap_user(File, Dev, MP, Line) ->
|
||||||
end;
|
end;
|
||||||
eof ->
|
eof ->
|
||||||
ok;
|
ok;
|
||||||
Error ->
|
{error, Error} ->
|
||||||
throw(#{file => File, line => Line, reason => Error})
|
throw(#{file => File, line => Line, reason => Error})
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue