is_mod_enabled
This commit is contained in:
parent
ced7acbf1c
commit
c2d4a60dec
|
@ -32,7 +32,7 @@
|
|||
open_listeners/1, close_listeners/1,
|
||||
load_all_plugins/0, unload_all_plugins/0,
|
||||
load_plugin/1, unload_plugin/1,
|
||||
load_all_mods/0,
|
||||
load_all_mods/0, is_mod_enabled/1,
|
||||
loaded_plugins/0,
|
||||
is_running/1]).
|
||||
|
||||
|
@ -211,6 +211,9 @@ load_all_mods() ->
|
|||
lager:info("load module ~s successfully", [Name])
|
||||
end, Mods).
|
||||
|
||||
is_mod_enabled(Name) ->
|
||||
env(modules, Name) =/= undefined.
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
%% @doc Is running?
|
||||
%% @end
|
||||
|
|
|
@ -41,7 +41,8 @@
|
|||
|
||||
load(Opts) ->
|
||||
File = proplists:get_value(file, Opts),
|
||||
Sections = compile(file:consult(File)),
|
||||
{ok, Terms} = file:consult(File),
|
||||
Sections = compile(Terms),
|
||||
emqttd_broker:hook(client_subscribe, {?MODULE, rewrite_subscribe},
|
||||
{?MODULE, rewrite, [subscribe, Sections]}),
|
||||
emqttd_broker:hook(client_unsubscribe, {?MODULE, rewrite_unsubscribe},
|
||||
|
|
|
@ -137,7 +137,7 @@ handle(Packet = ?CONNECT_PACKET(Var), State = #proto_state{peername = Peername =
|
|||
%% Start keepalive
|
||||
start_keepalive(KeepAlive),
|
||||
%% Run hooks
|
||||
emqttd_broker:run_hooks(client_connected, [{self(), ClientId1}]),
|
||||
emqttd_broker:foreach_hooks(client_connected, [{self(), ClientId1}]),
|
||||
{?CONNACK_ACCEPT, State1#proto_state{clientid = ClientId1,
|
||||
session = Session,
|
||||
will_msg = willmsg(Var)}};
|
||||
|
|
|
@ -46,14 +46,14 @@
|
|||
%% Authentication with username, password
|
||||
%{username, []},
|
||||
%% Authentication with clientid
|
||||
%{clientid, [{password, no}, {file, "etc/conf/clients.config"}]},
|
||||
%{clientid, [{password, no}, {file, "etc/clients.config"}]},
|
||||
%% Allow all
|
||||
{anonymous, []}
|
||||
]},
|
||||
%% ACL config
|
||||
{acl, [
|
||||
%% Internal ACL module
|
||||
{internal, [{file, "etc/conf/acl.config"}, {nomatch, allow}]}
|
||||
{internal, [{file, "etc/acl.config"}, {nomatch, allow}]}
|
||||
]}
|
||||
]},
|
||||
%% MQTT Protocol Options
|
||||
|
@ -111,7 +111,7 @@
|
|||
%% Subscribe topics automatically when client connected
|
||||
{autosub, [{"$Q/client/$c", 0}]},
|
||||
%% Rewrite rules
|
||||
{rewrite, [{file, "etc/conf/rewrite.config"}]}
|
||||
{rewrite, [{file, "etc/rewrite.config"}]}
|
||||
|
||||
]},
|
||||
%% Listeners
|
||||
|
|
|
@ -64,7 +64,6 @@
|
|||
{mkdir, "log/"},
|
||||
{mkdir, "etc/"},
|
||||
{mkdir, "etc/ssl/"},
|
||||
{mkdir, "etc/conf/"},
|
||||
{mkdir, "data/"},
|
||||
{mkdir, "plugins/"},
|
||||
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
|
||||
|
@ -77,9 +76,9 @@
|
|||
{copy, "files/ssl/ssl.crt", "etc/ssl/ssl.crt"},
|
||||
{copy, "files/ssl/ssl.key", "etc/ssl/ssl.key"},
|
||||
{template, "files/emqttd.config", "etc/emqttd.config"},
|
||||
{template, "files/acl.config", "etc/conf/acl.config"},
|
||||
{template, "files/rewrite.config", "etc/conf/rewrite.config"},
|
||||
{template, "files/clients.config", "etc/conf/clients.config"},
|
||||
{template, "files/acl.config", "etc/acl.config"},
|
||||
{template, "files/rewrite.config", "etc/rewrite.config"},
|
||||
{template, "files/clients.config", "etc/clients.config"},
|
||||
{template, "files/plugins.config", "etc/plugins.config"},
|
||||
{template, "files/vm.args", "etc/vm.args"}
|
||||
]}.
|
||||
|
|
Loading…
Reference in New Issue