Browse Source

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

ieQu1 1 year ago
parent
commit
be6c5e172f

+ 9 - 10
apps/emqx_management/src/emqx_mgmt_api_ds.erl

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

+ 5 - 0
apps/emqx_management/src/emqx_mgmt_cli.erl

@@ -848,6 +848,7 @@ ds(CMD) ->
             emqx_ctl:usage([{"ds", "Durable storage is disabled"}])
     end.
 
+-if(?EMQX_RELEASE_EDITION == ee).
 do_ds(["info"]) ->
     emqx_ds_replication_layer_meta:print_status();
 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 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