fix(exhook): correct the exhook server anme

This commit is contained in:
JianBo He 2021-04-15 20:10:09 +08:00 committed by turtleDeng
parent 373532f9e4
commit 6710a508df
2 changed files with 8 additions and 7 deletions

View File

@ -36,6 +36,7 @@
%% Mgmt APIs %% Mgmt APIs
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% XXX: Only return the running servers
-spec list() -> [emqx_exhook_server:server()]. -spec list() -> [emqx_exhook_server:server()].
list() -> list() ->
[server(Name) || Name <- running()]. [server(Name) || Name <- running()].

View File

@ -83,7 +83,7 @@
-spec load(atom(), list()) -> {ok, server()} | {error, term()} . -spec load(atom(), list()) -> {ok, server()} | {error, term()} .
load(Name0, Opts0) -> load(Name0, Opts0) ->
Name = prefix(Name0), Name = to_list(Name0),
{SvrAddr, ClientOpts} = channel_opts(Opts0), {SvrAddr, ClientOpts} = channel_opts(Opts0),
case emqx_exhook_sup:start_grpc_client_channel( case emqx_exhook_sup:start_grpc_client_channel(
Name, Name,
@ -110,12 +110,12 @@ load(Name0, Opts0) ->
end. end.
%% @private %% @private
prefix(Name) when is_atom(Name) -> to_list(Name) when is_atom(Name) ->
"exhook:" ++ atom_to_list(Name); atom_to_list(Name);
prefix(Name) when is_binary(Name) -> to_list(Name) when is_binary(Name) ->
"exhook:" ++ binary_to_list(Name); binary_to_list(Name);
prefix(Name) when is_list(Name) -> to_list(Name) when is_list(Name) ->
"exhook:" ++ Name. Name.
%% @private %% @private
channel_opts(Opts) -> channel_opts(Opts) ->