chore: limit the maximum number of api keys to 100
This commit is contained in:
parent
0f70786d13
commit
142826c4c3
|
@ -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.
|
||||||
|
|
|
@ -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>>
|
Loading…
Reference in New Issue