fix(modules): fix start/stop exhook module failure
This commit is contained in:
parent
2bc586b930
commit
56ac459b7f
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_exhook,
|
{application, emqx_exhook,
|
||||||
[{description, "EMQ X Extension for Hook"},
|
[{description, "EMQ X Extension for Hook"},
|
||||||
{vsn, "4.3.1"},
|
{vsn, "4.3.2"},
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{mod, {emqx_exhook_app, []}},
|
{mod, {emqx_exhook_app, []}},
|
||||||
|
|
|
@ -1,14 +1,22 @@
|
||||||
%% -*-: erlang -*-
|
%% -*-: erlang -*-
|
||||||
{VSN,
|
{VSN,
|
||||||
[
|
[
|
||||||
|
{"4.3.1", [
|
||||||
|
{load_module, emqx_exhook_server, brutal_purge, soft_purge, []}
|
||||||
|
]},
|
||||||
{"4.3.0", [
|
{"4.3.0", [
|
||||||
{load_module, emqx_exhook_pb, brutal_purge, soft_purge, []}
|
{load_module, emqx_exhook_pb, brutal_purge, soft_purge, []},
|
||||||
|
{load_module, emqx_exhook_server, brutal_purge, soft_purge, []}
|
||||||
]},
|
]},
|
||||||
{<<".*">>, []}
|
{<<".*">>, []}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
{"4.3.1", [
|
||||||
|
{load_module, emqx_exhook_server, brutal_purge, soft_purge, []}
|
||||||
|
]},
|
||||||
{"4.3.0", [
|
{"4.3.0", [
|
||||||
{load_module, emqx_exhook_pb, brutal_purge, soft_purge, []}
|
{load_module, emqx_exhook_pb, brutal_purge, soft_purge, []},
|
||||||
|
{load_module, emqx_exhook_server, brutal_purge, soft_purge, []}
|
||||||
]},
|
]},
|
||||||
{<<".*">>, []}
|
{<<".*">>, []}
|
||||||
]
|
]
|
||||||
|
|
|
@ -122,7 +122,7 @@ channel_opts(Opts) ->
|
||||||
Scheme = proplists:get_value(scheme, Opts),
|
Scheme = proplists:get_value(scheme, Opts),
|
||||||
Host = proplists:get_value(host, Opts),
|
Host = proplists:get_value(host, Opts),
|
||||||
Port = proplists:get_value(port, Opts),
|
Port = proplists:get_value(port, Opts),
|
||||||
SvrAddr = lists:flatten(io_lib:format("~s://~s:~w", [Scheme, Host, Port])),
|
SvrAddr = format_http_uri(Scheme, Host, Port),
|
||||||
ClientOpts = case Scheme of
|
ClientOpts = case Scheme of
|
||||||
https ->
|
https ->
|
||||||
SslOpts = lists:keydelete(ssl, 1, proplists:get_value(ssl_options, Opts, [])),
|
SslOpts = lists:keydelete(ssl, 1, proplists:get_value(ssl_options, Opts, [])),
|
||||||
|
@ -133,6 +133,13 @@ channel_opts(Opts) ->
|
||||||
end,
|
end,
|
||||||
{SvrAddr, ClientOpts}.
|
{SvrAddr, ClientOpts}.
|
||||||
|
|
||||||
|
format_http_uri(Scheme, Host0, Port) ->
|
||||||
|
Host = case is_tuple(Host0) of
|
||||||
|
true -> inet:ntoa(Host0);
|
||||||
|
_ -> Host0
|
||||||
|
end,
|
||||||
|
lists:flatten(io_lib:format("~s://~s:~w", [Scheme, Host, Port])).
|
||||||
|
|
||||||
-spec unload(server()) -> ok.
|
-spec unload(server()) -> ok.
|
||||||
unload(#server{name = Name, hookspec = HookSpecs}) ->
|
unload(#server{name = Name, hookspec = HookSpecs}) ->
|
||||||
_ = do_deinit(Name),
|
_ = do_deinit(Name),
|
||||||
|
|
Loading…
Reference in New Issue