Merge pull request #7901 from zmstone/0508-docs-authn-refine-config-doc
docs(authn): use hocon enum for use_id_type
This commit is contained in:
commit
5bd1ae6bed
|
@ -1,20 +1,20 @@
|
|||
emqx_authn_mnesia {
|
||||
authentication {
|
||||
desc {
|
||||
en: """Configuration of authenticator using built-in database as authentication data source."""
|
||||
en: """Configuration of authenticator using built-in database as data source."""
|
||||
zh: """使用内置数据库作为认证数据源的认证器的配置项。"""
|
||||
}
|
||||
}
|
||||
|
||||
user_id_type {
|
||||
desc {
|
||||
en: """Specify whether to use ClientID or Username as User ID for authentication."""
|
||||
zh: """指定使用 ClientID 还是 Username 作为 User ID 进行认证。"""
|
||||
en: """Specify whether to use `clientid` or `username` for authentication."""
|
||||
zh: """指定使用客户端ID `clientid` 还是用户名 `username` 进行认证。"""
|
||||
}
|
||||
|
||||
|
||||
label: {
|
||||
en: """User ID Type"""
|
||||
zh: """用户 ID 类型"""
|
||||
en: """Authentication ID Type"""
|
||||
zh: """认证 ID 类型"""
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
group_match_spec/1
|
||||
]).
|
||||
|
||||
-type user_id_type() :: clientid | username.
|
||||
-type user_group() :: binary().
|
||||
-type user_id() :: binary().
|
||||
|
||||
|
@ -64,8 +63,6 @@
|
|||
is_superuser :: boolean()
|
||||
}).
|
||||
|
||||
-reflect_type([user_id_type/0]).
|
||||
|
||||
-export([mnesia/1]).
|
||||
|
||||
-boot_mnesia({mnesia, [boot]}).
|
||||
|
@ -115,7 +112,7 @@ desc(?CONF_NS) ->
|
|||
desc(_) ->
|
||||
undefined.
|
||||
|
||||
user_id_type(type) -> user_id_type();
|
||||
user_id_type(type) -> hoconsc:enum([clientid, username]);
|
||||
user_id_type(desc) -> ?DESC(?FUNCTION_NAME);
|
||||
user_id_type(default) -> <<"username">>;
|
||||
user_id_type(required) -> true;
|
||||
|
|
|
@ -580,9 +580,6 @@ hocon_schema_to_spec(?UNION(Types), LocalModule) ->
|
|||
hocon_schema_to_spec(Atom, _LocalModule) when is_atom(Atom) ->
|
||||
{#{type => string, enum => [Atom]}, []}.
|
||||
|
||||
%% todo: Find a way to fetch enum value from user_id_type().
|
||||
typename_to_spec("user_id_type()", _Mod) ->
|
||||
#{type => string, enum => [clientid, username]};
|
||||
typename_to_spec("term()", _Mod) ->
|
||||
#{type => string, example => <<"any">>};
|
||||
typename_to_spec("boolean()", _Mod) ->
|
||||
|
|
Loading…
Reference in New Issue