fix(ds): Disable DS management APIs for builtin_local backend

This commit is contained in:
ieQu1 2024-06-14 23:32:38 +02:00
parent 99c9b56cf3
commit be6c5e172f
No known key found for this signature in database
GPG Key ID: 488654DF3FED6FDE
2 changed files with 14 additions and 10 deletions

View File

@ -15,13 +15,9 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
-module(emqx_mgmt_api_ds). -module(emqx_mgmt_api_ds).
-behaviour(minirest_api). -if(?EMQX_RELEASE_EDITION == ee).
-include_lib("emqx/include/logger.hrl"). -behaviour(minirest_api).
-include_lib("typerefl/include/types.hrl").
-include_lib("hocon/include/hoconsc.hrl").
-include_lib("emqx_utils/include/emqx_utils_api.hrl").
-include_lib("emqx/include/emqx_persistent_message.hrl").
-import(hoconsc, [mk/2, ref/1, enum/1, array/1]). -import(hoconsc, [mk/2, ref/1, enum/1, array/1]).
@ -50,10 +46,11 @@
fields/1 fields/1
]). ]).
%% internal exports: -include_lib("emqx/include/logger.hrl").
-export([]). -include_lib("typerefl/include/types.hrl").
-include_lib("hocon/include/hoconsc.hrl").
-export_type([]). -include_lib("emqx_utils/include/emqx_utils_api.hrl").
-include_lib("emqx/include/emqx_persistent_message.hrl").
%%================================================================================ %%================================================================================
%% Type declarations %% Type declarations
@ -494,3 +491,5 @@ meta_result_to_binary({error, {member_of_replica_sets, DBNames}}) ->
meta_result_to_binary({error, Err}) -> meta_result_to_binary({error, Err}) ->
IOList = io_lib:format("Error: ~p", [Err]), IOList = io_lib:format("Error: ~p", [Err]),
{error, iolist_to_binary(IOList)}. {error, iolist_to_binary(IOList)}.
-endif.

View File

@ -848,6 +848,7 @@ ds(CMD) ->
emqx_ctl:usage([{"ds", "Durable storage is disabled"}]) emqx_ctl:usage([{"ds", "Durable storage is disabled"}])
end. end.
-if(?EMQX_RELEASE_EDITION == ee).
do_ds(["info"]) -> do_ds(["info"]) ->
emqx_ds_replication_layer_meta:print_status(); emqx_ds_replication_layer_meta:print_status();
do_ds(["set_replicas", DBStr | SitesStr]) -> do_ds(["set_replicas", DBStr | SitesStr]) ->
@ -907,6 +908,10 @@ do_ds(_) ->
{"ds leave <storage> <site>", "Remove site from the replica set of the storage"}, {"ds leave <storage> <site>", "Remove site from the replica set of the storage"},
{"ds forget <site>", "Forcefully remove a site from the list of known sites"} {"ds forget <site>", "Forcefully remove a site from the list of known sites"}
]). ]).
-else.
do_ds(_CMD) ->
emqx_ctl:usage([{"ds", "DS CLI is not available in this edition of EMQX"}]).
-endif.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Dump ETS %% Dump ETS