chore: limit the maximum number of api keys to 100

This commit is contained in:
Zhongwen Deng 2023-01-09 19:15:50 +08:00
parent 0f70786d13
commit 142826c4c3
2 changed files with 3 additions and 3 deletions

View File

@ -59,7 +59,7 @@ mnesia(boot) ->
]). ]).
create(Name, Enable, ExpiredAt, Desc) -> create(Name, Enable, ExpiredAt, Desc) ->
case mnesia:table_info(?APP, size) < 30 of case mnesia:table_info(?APP, size) < 1024 of
true -> create_app(Name, Enable, ExpiredAt, Desc); true -> create_app(Name, Enable, ExpiredAt, Desc);
false -> {error, "Maximum ApiKey"} false -> {error, "Maximum ApiKey"}
end. end.

View File

@ -13,7 +13,7 @@
%% See the License for the specific language governing permissions and %% See the License for the specific language governing permissions and
%% limitations under the License. %% limitations under the License.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
-module(emqx_mgmt_api_app_SUITE). -module(emqx_mgmt_api_api_keys_SUITE).
-compile(export_all). -compile(export_all).
-compile(nowarn_export_all). -compile(nowarn_export_all).
@ -69,7 +69,7 @@ t_create_failed(_Config) ->
?assertEqual(BadRequest, create_app(LongName)), ?assertEqual(BadRequest, create_app(LongName)),
{ok, List} = list_app(), {ok, List} = list_app(),
CreateNum = 30 - erlang:length(List), CreateNum = 1024 - erlang:length(List),
Names = lists:map( Names = lists:map(
fun(Seq) -> fun(Seq) ->
<<"EMQX-API-FAILED-KEY-", (integer_to_binary(Seq))/binary>> <<"EMQX-API-FAILED-KEY-", (integer_to_binary(Seq))/binary>>