Selaa lähdekoodia

chore(emqx_modules): add emqx_modules api path

zhanghongtong 5 vuotta sitten
vanhempi
commit
db92f79713
1 muutettua tiedostoa jossa 2 lisäystä ja 5 poistoa
  1. 2 5
      apps/emqx_management/src/emqx_mgmt_http.erl

+ 2 - 5
apps/emqx_management/src/emqx_mgmt_http.erl

@@ -85,7 +85,7 @@ listener_name(Proto) ->
 
 http_handlers() ->
     Plugins = lists:map(fun(Plugin) -> Plugin#plugin.name end, emqx_plugins:list()),
-    [{"/api/v4", minirest:handler(#{apps   => Plugins -- ?EXCEPT_PLUGIN,
+    [{"/api/v4", minirest:handler(#{apps   => Plugins ++ [emqx_modules] -- ?EXCEPT_PLUGIN,
                                     except => ?EXCEPT,
                                     filter => fun filter/1}),
                  [{authorization, fun authorize_appid/1}]}].
@@ -119,15 +119,12 @@ authorize_appid(Req) ->
          _  -> false
     end.
 
--ifdef(EMQX_ENTERPRISE).
-filter(_) -> true.
--else.
+filter(#{app := emqx_modules}) -> true;
 filter(#{app := App}) ->
     case emqx_plugins:find_plugin(App) of
         false -> false;
         Plugin -> Plugin#plugin.active
     end.
--endif.
 
 format(Port) when is_integer(Port) ->
     io_lib:format("0.0.0.0:~w", [Port]);