Umbrella fix build (#5)
* fix(emqx_auth_jwt): Dialyzer warnings * fix(emqx_auth_mnesia_cli): Dialyzer warnings * fix(emqx_bridge_mqtt_cli): Dialyzer warnings * fix(emqx_bridge_mqtt_cli): Dialyzer warnings * fix(emqx_auth_redis_sup): Dialyzer warnings * fix(emqx_bridge_mqtt): Dialyzer warnings * fix(emqx_auth_pgsql_cli): Dialyzer warnings * fix(emqx_bridge_mqtt_cli): Dialyzer warnings * fix(emqx_auth_mnesia_cli): Dialyzer warnings
This commit is contained in:
parent
18ddde0174
commit
13b67c0d19
|
@ -156,11 +156,17 @@ auth_username_cli(["add", Username, Password]) ->
|
||||||
{error, Reason} -> emqx_ctl:print("Error: ~p~n", [Reason])
|
{error, Reason} -> emqx_ctl:print("Error: ~p~n", [Reason])
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
auth_username_cli(["update", Username, NewPassword]) ->
|
auth_username_cli(["update", Username, NewPassword]) ->
|
||||||
case update_user({username, iolist_to_binary(Username)}, iolist_to_binary(NewPassword)) of
|
case update_user({username, iolist_to_binary(Username)}, iolist_to_binary(NewPassword)) of
|
||||||
ok -> emqx_ctl:print("ok~n");
|
ok -> emqx_ctl:print("ok~n");
|
||||||
{error, Reason} -> emqx_ctl:print("Error: ~p~n", [Reason])
|
{error, Reason} -> emqx_ctl:print("Error: ~p~n", [Reason])
|
||||||
end;
|
end;
|
||||||
|
=======
|
||||||
|
acl_cli(["del", Login, Topic])->
|
||||||
|
ok = remove_acl(iolist_to_binary(Login), iolist_to_binary(Topic)),
|
||||||
|
emqx_ctl:print("ok~n");
|
||||||
|
>>>>>>> bb37bac5... Umbrella fix build (#5)
|
||||||
|
|
||||||
auth_username_cli(["del", Username]) ->
|
auth_username_cli(["del", Username]) ->
|
||||||
case remove_user({username, iolist_to_binary(Username)}) of
|
case remove_user({username, iolist_to_binary(Username)}) of
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
, equery/3
|
, equery/3
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
-type client_info() :: #{username:=_, clientid:=_, peerhost:=_, _=>_}.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Avoid SQL Injection: Parse SQL to Parameter Query.
|
%% Avoid SQL Injection: Parse SQL to Parameter Query.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
@ -104,9 +106,11 @@ conn_opts([Opt = {ssl_opts, _}|Opts], Acc) ->
|
||||||
conn_opts([_Opt|Opts], Acc) ->
|
conn_opts([_Opt|Opts], Acc) ->
|
||||||
conn_opts(Opts, Acc).
|
conn_opts(Opts, Acc).
|
||||||
|
|
||||||
|
-spec(equery(atom(), string() | epgsql:statement(), Parameters::[any()]) -> {ok, ColumnsDescription :: [any()], RowsValues :: [any()]} | {error, any()} ).
|
||||||
equery(Pool, Sql, Params) ->
|
equery(Pool, Sql, Params) ->
|
||||||
ecpool:with_client(Pool, fun(C) -> epgsql:prepared_query(C, Sql, Params) end).
|
ecpool:with_client(Pool, fun(C) -> epgsql:prepared_query(C, Sql, Params) end).
|
||||||
|
|
||||||
|
-spec(equery(atom(), string() | epgsql:statement(), Parameters::[any()], client_info()) -> {ok, ColumnsDescription :: [any()], RowsValues :: [any()]} | {error, any()} ).
|
||||||
equery(Pool, Sql, Params, ClientInfo) ->
|
equery(Pool, Sql, Params, ClientInfo) ->
|
||||||
ecpool:with_client(Pool, fun(C) -> epgsql:prepared_query(C, Sql, replvar(Params, ClientInfo)) end).
|
ecpool:with_client(Pool, fun(C) -> epgsql:prepared_query(C, Sql, replvar(Params, ClientInfo)) end).
|
||||||
|
|
||||||
|
|
|
@ -186,6 +186,5 @@ replvar([Key|More], Options) ->
|
||||||
|
|
||||||
%% ${node} => node()
|
%% ${node} => node()
|
||||||
feedvar(clientid, ClientId, _) ->
|
feedvar(clientid, ClientId, _) ->
|
||||||
iolist_to_binary(re:replace(ClientId, "\\${node}", atom_to_list(node())));
|
iolist_to_binary(re:replace(ClientId, "\\${node}", atom_to_list(node()))).
|
||||||
feedvar(_, Val, _) ->
|
|
||||||
Val.
|
|
||||||
|
|
|
@ -56,16 +56,12 @@ cli(["forwards", Name]) ->
|
||||||
end, emqx_bridge_worker:get_forwards(Name));
|
end, emqx_bridge_worker:get_forwards(Name));
|
||||||
|
|
||||||
cli(["add-forward", Name, Topic]) ->
|
cli(["add-forward", Name, Topic]) ->
|
||||||
case emqx_bridge_worker:ensure_forward_present(Name, iolist_to_binary(Topic)) of
|
ok = emqx_bridge_worker:ensure_forward_present(Name, iolist_to_binary(Topic)),
|
||||||
ok -> emqx_ctl:print("Add-forward topic successfully.~n");
|
emqx_ctl:print("Add-forward topic successfully.~n");
|
||||||
{error, Reason} -> emqx_ctl:print("Add-forward failed reason: ~p.~n", [Reason])
|
|
||||||
end;
|
|
||||||
|
|
||||||
cli(["del-forward", Name, Topic]) ->
|
cli(["del-forward", Name, Topic]) ->
|
||||||
case emqx_bridge_worker:ensure_forward_absent(Name, iolist_to_binary(Topic)) of
|
ok = emqx_bridge_worker:ensure_forward_absent(Name, iolist_to_binary(Topic)),
|
||||||
ok -> emqx_ctl:print("Del-forward topic successfully.~n");
|
emqx_ctl:print("Del-forward topic successfully.~n");
|
||||||
{error, Reason} -> emqx_ctl:print("Del-forward failed reason: ~p.~n", [Reason])
|
|
||||||
end;
|
|
||||||
|
|
||||||
cli(["subscriptions", Name]) ->
|
cli(["subscriptions", Name]) ->
|
||||||
foreach(fun({Topic, Qos}) ->
|
foreach(fun({Topic, Qos}) ->
|
||||||
|
@ -79,10 +75,8 @@ cli(["add-subscription", Name, Topic, Qos]) ->
|
||||||
end;
|
end;
|
||||||
|
|
||||||
cli(["del-subscription", Name, Topic]) ->
|
cli(["del-subscription", Name, Topic]) ->
|
||||||
case emqx_bridge_worker:ensure_subscription_absent(Name, Topic) of
|
ok = emqx_bridge_worker:ensure_subscription_absent(Name, Topic),
|
||||||
ok -> emqx_ctl:print("Del-subscription topic successfully.~n");
|
emqx_ctl:print("Del-subscription topic successfully.~n");
|
||||||
{error, Reason} -> emqx_ctl:print("Del-subscription failed reason: ~p.~n", [Reason])
|
|
||||||
end;
|
|
||||||
|
|
||||||
cli(_) ->
|
cli(_) ->
|
||||||
emqx_ctl:usage([{"bridges list", "List bridges"},
|
emqx_ctl:usage([{"bridges list", "List bridges"},
|
||||||
|
|
Loading…
Reference in New Issue