chore: apply review suggestion
This commit is contained in:
parent
29076f7eb8
commit
24d2534641
|
@ -543,8 +543,9 @@ boostrap_user_from_file(Config, State) ->
|
|||
case maps:get(boostrap_file, Config, <<>>) of
|
||||
<<>> ->
|
||||
ok;
|
||||
FileName ->
|
||||
FileName0 ->
|
||||
#{boostrap_type := Type} = Config,
|
||||
FileName = emqx_schema:naive_env_interpolation(FileName0),
|
||||
case file:read_file(FileName) of
|
||||
{ok, FileData} ->
|
||||
%% if there is a key conflict, override with the key which from the bootstrap file
|
||||
|
@ -552,10 +553,10 @@ boostrap_user_from_file(Config, State) ->
|
|||
ok;
|
||||
{error, Reason} ->
|
||||
?SLOG(warning, #{
|
||||
msg => "boostrap_authn(built_in_database)_failed",
|
||||
msg => "boostrap_authn_built_in_database_failed",
|
||||
boostrap_file => FileName,
|
||||
boostrap_type => Type,
|
||||
reason => Reason
|
||||
reason => emqx_utils:explain_posix(Reason)
|
||||
})
|
||||
end
|
||||
end.
|
||||
|
|
|
@ -1 +1 @@
|
|||
Added support for configuring the bootstrap_file and bootstrap_type when using the built-in db authentication method.
|
||||
Added new configs `bootstrap_file` and `bootstrap_type` for built-in database for authentication to support bootstrapping the table with csv and json file.
|
||||
|
|
|
@ -10,13 +10,15 @@ user_id_type.label:
|
|||
"""Authentication ID Type"""
|
||||
|
||||
bootstrap_file.desc:
|
||||
"""The bootstrap file imports users into the built-in database."""
|
||||
"""The bootstrap file imports users into the built-in database.
|
||||
the file content format is determined by `bootstrap_type`."""
|
||||
|
||||
bootstrap_file.label:
|
||||
"""Bootstrap File Path"""
|
||||
|
||||
bootstrap_type.desc:
|
||||
"""plain: bootstrap_file.cvs should be `user_id,password,is_superuser`.
|
||||
hash: bootstrap_file.cvs should be `user_id,password_hash,salt,is_superuser`"""
|
||||
"""plain: bootstrap_file.cvs should have lines of format `{user_id},{password},{is_superuser}` where `user_id` can be either clientid or username depending on `user_id_type`.
|
||||
hash: bootstrap_file.cvs should have line of format `{user_id},{password_hash},{salt},{is_superuser}.`
|
||||
All file format support is the same as `authentication/password_based:built_in_database/import_users` API."""
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue