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
%%--------------------------------------------------------------------
%% XXX: Only return the running servers
-spec list() -> [emqx_exhook_server:server()].
list() ->
[server(Name) || Name <- running()].

View File

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