diff --git a/apps/emqx/src/emqx_alarm.erl b/apps/emqx/src/emqx_alarm.erl index ab3e2d702..44b005faa 100644 --- a/apps/emqx/src/emqx_alarm.erl +++ b/apps/emqx/src/emqx_alarm.erl @@ -28,7 +28,7 @@ -boot_mnesia({mnesia, [boot]}). -copy_mnesia({mnesia, [copy]}). --export([pre_config_update/2]). +-export([post_config_update/3]). -export([ start_link/0 , stop/0 @@ -151,14 +151,9 @@ get_alarms(activated) -> get_alarms(deactivated) -> gen_server:call(?MODULE, {get_alarms, deactivated}). -pre_config_update(#{<<"validity_period">> := Period0} = NewConf, OldConf) -> - ?MODULE ! {update_timer, hocon_postprocess:duration(Period0)}, - merge(OldConf, NewConf); -pre_config_update(NewConf, OldConf) -> - merge(OldConf, NewConf). - -merge(undefined, New) -> New; -merge(Old, New) -> maps:merge(Old, New). +post_config_update(_, #{validity_period := Period0}, _OldConf) -> + ?MODULE ! {update_timer, Period0}, + ok. format(#activated_alarm{name = Name, message = Message, activate_at = At, details = Details}) -> Now = erlang:system_time(microsecond), diff --git a/apps/emqx/test/emqx_alarm_SUITE.erl b/apps/emqx/test/emqx_alarm_SUITE.erl index b8af41232..605300d2f 100644 --- a/apps/emqx/test/emqx_alarm_SUITE.erl +++ b/apps/emqx/test/emqx_alarm_SUITE.erl @@ -28,14 +28,14 @@ all() -> emqx_ct:all(?MODULE). init_per_testcase(t_size_limit, Config) -> emqx_ct_helpers:boot_modules(all), emqx_ct_helpers:start_apps([]), - {ok, _, _} = emqx:update_config([alarm], #{ + {ok, _} = emqx:update_config([alarm], #{ <<"size_limit">> => 2 }), Config; init_per_testcase(t_validity_period, Config) -> emqx_ct_helpers:boot_modules(all), emqx_ct_helpers:start_apps([]), - {ok, _, _} = emqx:update_config([alarm], #{ + {ok, _} = emqx:update_config([alarm], #{ <<"validity_period">> => <<"1s">> }), Config; diff --git a/apps/emqx_authz/src/emqx_authz.erl b/apps/emqx_authz/src/emqx_authz.erl index 3f8177c51..6197cd685 100644 --- a/apps/emqx_authz/src/emqx_authz.erl +++ b/apps/emqx_authz/src/emqx_authz.erl @@ -69,12 +69,12 @@ update(Cmd, Rules) -> pre_config_update({move, Id, <<"top">>}, Conf) when is_list(Conf) -> {Index, _} = find_rule_by_id(Id), {List1, List2} = lists:split(Index, Conf), - [lists:nth(Index, Conf)] ++ lists:droplast(List1) ++ List2; + {ok, [lists:nth(Index, Conf)] ++ lists:droplast(List1) ++ List2}; pre_config_update({move, Id, <<"bottom">>}, Conf) when is_list(Conf) -> {Index, _} = find_rule_by_id(Id), {List1, List2} = lists:split(Index, Conf), - lists:droplast(List1) ++ List2 ++ [lists:nth(Index, Conf)]; + {ok, lists:droplast(List1) ++ List2 ++ [lists:nth(Index, Conf)]}; pre_config_update({move, Id, #{<<"before">> := BeforeId}}, Conf) when is_list(Conf) -> {Index1, _} = find_rule_by_id(Id), @@ -83,9 +83,9 @@ pre_config_update({move, Id, #{<<"before">> := BeforeId}}, Conf) when is_list(Co Conf2 = lists:nth(Index2, Conf), {List1, List2} = lists:split(Index2, Conf), - lists:delete(Conf1, lists:droplast(List1)) - ++ [Conf1] ++ [Conf2] - ++ lists:delete(Conf1, List2); + {ok, lists:delete(Conf1, lists:droplast(List1)) + ++ [Conf1] ++ [Conf2] + ++ lists:delete(Conf1, List2)}; pre_config_update({move, Id, #{<<"after">> := AfterId}}, Conf) when is_list(Conf) -> {Index1, _} = find_rule_by_id(Id), @@ -93,21 +93,21 @@ pre_config_update({move, Id, #{<<"after">> := AfterId}}, Conf) when is_list(Conf {Index2, _} = find_rule_by_id(AfterId), {List1, List2} = lists:split(Index2, Conf), - lists:delete(Conf1, List1) - ++ [Conf1] - ++ lists:delete(Conf1, List2); + {ok, lists:delete(Conf1, List1) + ++ [Conf1] + ++ lists:delete(Conf1, List2)}; pre_config_update({head, Rules}, Conf) when is_list(Rules), is_list(Conf) -> - Rules ++ Conf; + {ok, Rules ++ Conf}; pre_config_update({tail, Rules}, Conf) when is_list(Rules), is_list(Conf) -> - Conf ++ Rules; + {ok, Conf ++ Rules}; pre_config_update({{replace_once, Id}, Rule}, Conf) when is_map(Rule), is_list(Conf) -> {Index, _} = find_rule_by_id(Id), {List1, List2} = lists:split(Index, Conf), - lists:droplast(List1) ++ [Rule] ++ List2; + {ok, lists:droplast(List1) ++ [Rule] ++ List2}; pre_config_update({_, Rules}, _Conf) when is_list(Rules)-> %% overwrite the entire config! - Rules. + {ok, Rules}. post_config_update(_, undefined, _Conf) -> ok; diff --git a/apps/emqx_authz/src/emqx_authz_api.erl b/apps/emqx_authz/src/emqx_authz_api.erl index 21519153a..a445c7016 100644 --- a/apps/emqx_authz/src/emqx_authz_api.erl +++ b/apps/emqx_authz/src/emqx_authz_api.erl @@ -449,7 +449,7 @@ rules(post, Request) -> {ok, Body, _} = cowboy_req:read_body(Request), RawConfig = jsx:decode(Body, [return_maps]), case emqx_authz:update(head, [RawConfig]) of - {ok, _, _} -> {204}; + {ok, _} -> {204}; {error, Reason} -> {400, #{code => <<"BAD_REQUEST">>, messgae => atom_to_binary(Reason)}} @@ -458,7 +458,7 @@ rules(put, Request) -> {ok, Body, _} = cowboy_req:read_body(Request), RawConfig = jsx:decode(Body, [return_maps]), case emqx_authz:update(replace, RawConfig) of - {ok, _, _} -> {204}; + {ok, _} -> {204}; {error, Reason} -> {400, #{code => <<"BAD_REQUEST">>, messgae => atom_to_binary(Reason)}} @@ -486,7 +486,7 @@ rule(put, Request) -> {ok, Body, _} = cowboy_req:read_body(Request), RawConfig = jsx:decode(Body, [return_maps]), case emqx_authz:update({replace_once, RuleId}, RawConfig) of - {ok, _, _} -> {204}; + {ok, _} -> {204}; {error, not_found_rule} -> {404, #{code => <<"NOT_FOUND">>, messgae => <<"rule ", RuleId/binary, " not found">>}}; @@ -497,7 +497,7 @@ rule(put, Request) -> rule(delete, Request) -> RuleId = cowboy_req:binding(id, Request), case emqx_authz:update({replace_once, RuleId}, #{}) of - {ok, _, _} -> {204}; + {ok, _} -> {204}; {error, Reason} -> {400, #{code => <<"BAD_REQUEST">>, messgae => atom_to_binary(Reason)}} @@ -507,7 +507,7 @@ move_rule(post, Request) -> {ok, Body, _} = cowboy_req:read_body(Request), #{<<"position">> := Position} = jsx:decode(Body, [return_maps]), case emqx_authz:move(RuleId, Position) of - {ok, _, _} -> {204}; + {ok, _} -> {204}; {error, not_found_rule} -> {404, #{code => <<"NOT_FOUND">>, messgae => <<"rule ", RuleId/binary, " not found">>}}; diff --git a/apps/emqx_authz/test/emqx_authz_SUITE.erl b/apps/emqx_authz/test/emqx_authz_SUITE.erl index 85ef400f7..514b0d48b 100644 --- a/apps/emqx_authz/test/emqx_authz_SUITE.erl +++ b/apps/emqx_authz/test/emqx_authz_SUITE.erl @@ -33,17 +33,17 @@ groups() -> init_per_suite(Config) -> ok = emqx_config:init_load(emqx_authz_schema, ?CONF_DEFAULT), ok = emqx_ct_helpers:start_apps([emqx_authz]), - {ok, _, _} = emqx:update_config([zones, default, authorization, cache, enable], false), - {ok, _, _} = emqx:update_config([zones, default, authorization, enable], true), + {ok, _} = emqx:update_config([zones, default, authorization, cache, enable], false), + {ok, _} = emqx:update_config([zones, default, authorization, enable], true), Config. end_per_suite(_Config) -> - {ok, _, _} = emqx_authz:update(replace, []), + {ok, _} = emqx_authz:update(replace, []), emqx_ct_helpers:stop_apps([emqx_authz]), ok. init_per_testcase(_, Config) -> - {ok, _, _} = emqx_authz:update(replace, []), + {ok, _} = emqx_authz:update(replace, []), Config. -define(RULE1, #{<<"principal">> => <<"all">>, @@ -82,9 +82,9 @@ init_per_testcase(_, Config) -> %%------------------------------------------------------------------------------ t_update_rule(_) -> - {ok, _, _} = emqx_authz:update(replace, [?RULE2]), - {ok, _, _} = emqx_authz:update(head, [?RULE1]), - {ok, _, _} = emqx_authz:update(tail, [?RULE3]), + {ok, _} = emqx_authz:update(replace, [?RULE2]), + {ok, _} = emqx_authz:update(head, [?RULE1]), + {ok, _} = emqx_authz:update(tail, [?RULE3]), Lists1 = emqx_authz:check_rules([?RULE1, ?RULE2, ?RULE3]), ?assertMatch(Lists1, emqx_config:get([authorization, rules], [])), @@ -107,7 +107,7 @@ t_update_rule(_) -> } ] = emqx_authz:lookup(), - {ok, _, _} = emqx_authz:update({replace_once, Id3}, ?RULE4), + {ok, _} = emqx_authz:update({replace_once, Id3}, ?RULE4), Lists2 = emqx_authz:check_rules([?RULE1, ?RULE2, ?RULE4]), ?assertMatch(Lists2, emqx_config:get([authorization, rules], [])), @@ -132,38 +132,38 @@ t_update_rule(_) -> } ] = emqx_authz:lookup(), - {ok, _, _} = emqx_authz:update(replace, []). + {ok, _} = emqx_authz:update(replace, []). t_move_rule(_) -> - {ok, _, _} = emqx_authz:update(replace, [?RULE1, ?RULE2, ?RULE3, ?RULE4]), + {ok, _} = emqx_authz:update(replace, [?RULE1, ?RULE2, ?RULE3, ?RULE4]), [#{annotations := #{id := Id1}}, #{annotations := #{id := Id2}}, #{annotations := #{id := Id3}}, #{annotations := #{id := Id4}} ] = emqx_authz:lookup(), - {ok, _, _} = emqx_authz:move(Id4, <<"top">>), + {ok, _} = emqx_authz:move(Id4, <<"top">>), ?assertMatch([#{annotations := #{id := Id4}}, #{annotations := #{id := Id1}}, #{annotations := #{id := Id2}}, #{annotations := #{id := Id3}} ], emqx_authz:lookup()), - {ok, _, _} = emqx_authz:move(Id1, <<"bottom">>), + {ok, _} = emqx_authz:move(Id1, <<"bottom">>), ?assertMatch([#{annotations := #{id := Id4}}, #{annotations := #{id := Id2}}, #{annotations := #{id := Id3}}, #{annotations := #{id := Id1}} ], emqx_authz:lookup()), - {ok, _, _} = emqx_authz:move(Id3, #{<<"before">> => Id4}), + {ok, _} = emqx_authz:move(Id3, #{<<"before">> => Id4}), ?assertMatch([#{annotations := #{id := Id3}}, #{annotations := #{id := Id4}}, #{annotations := #{id := Id2}}, #{annotations := #{id := Id1}} ], emqx_authz:lookup()), - {ok, _, _} = emqx_authz:move(Id2, #{<<"after">> => Id1}), + {ok, _} = emqx_authz:move(Id2, #{<<"after">> => Id1}), ?assertMatch([#{annotations := #{id := Id3}}, #{annotations := #{id := Id4}}, #{annotations := #{id := Id1}}, diff --git a/apps/emqx_authz/test/emqx_authz_api_SUITE.erl b/apps/emqx_authz/test/emqx_authz_api_SUITE.erl index 23bcac31c..c4930ace6 100644 --- a/apps/emqx_authz/test/emqx_authz_api_SUITE.erl +++ b/apps/emqx_authz/test/emqx_authz_api_SUITE.erl @@ -76,13 +76,13 @@ init_per_suite(Config) -> ekka_mnesia:start(), emqx_mgmt_auth:mnesia(boot), ok = emqx_ct_helpers:start_apps([emqx_management, emqx_authz], fun set_special_configs/1), - {ok, _, _} = emqx:update_config([zones, default, authorization, cache, enable], false), - {ok, _, _} = emqx:update_config([zones, default, authorization, enable], true), + {ok, _} = emqx:update_config([zones, default, authorization, cache, enable], false), + {ok, _} = emqx:update_config([zones, default, authorization, enable], true), Config. end_per_suite(_Config) -> - {ok, _, _} = emqx_authz:update(replace, []), + {ok, _} = emqx_authz:update(replace, []), emqx_ct_helpers:stop_apps([emqx_authz, emqx_management]), ok. @@ -155,7 +155,7 @@ t_api(_) -> ok. t_move_rule(_) -> - {ok, _, _} = emqx_authz:update(replace, [?RULE1, ?RULE2, ?RULE3, ?RULE4]), + {ok, _} = emqx_authz:update(replace, [?RULE1, ?RULE2, ?RULE3, ?RULE4]), [#{annotations := #{id := Id1}}, #{annotations := #{id := Id2}}, #{annotations := #{id := Id3}}, diff --git a/apps/emqx_authz/test/emqx_authz_http_SUITE.erl b/apps/emqx_authz/test/emqx_authz_http_SUITE.erl index ff04148d9..d50c7a43d 100644 --- a/apps/emqx_authz/test/emqx_authz_http_SUITE.erl +++ b/apps/emqx_authz/test/emqx_authz_http_SUITE.erl @@ -35,8 +35,8 @@ init_per_suite(Config) -> ok = emqx_ct_helpers:start_apps([emqx_authz]), - {ok, _, _} = emqx:update_config([zones, default, authorization, cache, enable], false), - {ok, _, _} = emqx:update_config([zones, default, authorization, enable], true), + {ok, _} = emqx:update_config([zones, default, authorization, cache, enable], false), + {ok, _} = emqx:update_config([zones, default, authorization, enable], true), Rules = [#{ <<"config">> => #{ <<"url">> => <<"https://fake.com:443/">>, <<"headers">> => #{}, @@ -46,11 +46,11 @@ init_per_suite(Config) -> <<"principal">> => <<"all">>, <<"type">> => <<"http">>} ], - {ok, _, _} = emqx_authz:update(replace, Rules), + {ok, _} = emqx_authz:update(replace, Rules), Config. end_per_suite(_Config) -> - {ok, _, _} = emqx_authz:update(replace, []), + {ok, _} = emqx_authz:update(replace, []), emqx_ct_helpers:stop_apps([emqx_authz, emqx_resource]), meck:unload(emqx_resource), ok. diff --git a/apps/emqx_authz/test/emqx_authz_mongo_SUITE.erl b/apps/emqx_authz/test/emqx_authz_mongo_SUITE.erl index 5f179c0b0..ba18cb1cb 100644 --- a/apps/emqx_authz/test/emqx_authz_mongo_SUITE.erl +++ b/apps/emqx_authz/test/emqx_authz_mongo_SUITE.erl @@ -34,8 +34,8 @@ init_per_suite(Config) -> meck:expect(emqx_resource, remove, fun(_) -> ok end ), ok = emqx_ct_helpers:start_apps([emqx_authz]), - {ok, _, _} = emqx:update_config([zones, default, authorization, cache, enable], false), - {ok, _, _} = emqx:update_config([zones, default, authorization, enable], true), + {ok, _} = emqx:update_config([zones, default, authorization, cache, enable], false), + {ok, _} = emqx:update_config([zones, default, authorization, enable], true), Rules = [#{ <<"config">> => #{ <<"mongo_type">> => <<"single">>, <<"server">> => <<"127.0.0.1:27017">>, @@ -47,11 +47,11 @@ init_per_suite(Config) -> <<"find">> => #{<<"a">> => <<"b">>}, <<"type">> => <<"mongo">>} ], - {ok, _, _} = emqx_authz:update(replace, Rules), + {ok, _} = emqx_authz:update(replace, Rules), Config. end_per_suite(_Config) -> - {ok, _, _} = emqx_authz:update(replace, []), + {ok, _} = emqx_authz:update(replace, []), emqx_ct_helpers:stop_apps([emqx_authz, emqx_resource]), meck:unload(emqx_resource), ok. diff --git a/apps/emqx_authz/test/emqx_authz_mysql_SUITE.erl b/apps/emqx_authz/test/emqx_authz_mysql_SUITE.erl index 61e738041..81021f6e8 100644 --- a/apps/emqx_authz/test/emqx_authz_mysql_SUITE.erl +++ b/apps/emqx_authz/test/emqx_authz_mysql_SUITE.erl @@ -35,8 +35,8 @@ init_per_suite(Config) -> ok = emqx_ct_helpers:start_apps([emqx_authz]), - {ok, _, _} = emqx:update_config([zones, default, authorization, cache, enable], false), - {ok, _, _} = emqx:update_config([zones, default, authorization, enable], true), + {ok, _} = emqx:update_config([zones, default, authorization, cache, enable], false), + {ok, _} = emqx:update_config([zones, default, authorization, enable], true), Rules = [#{ <<"config">> => #{ <<"server">> => <<"127.0.0.1:27017">>, <<"pool_size">> => 1, @@ -49,11 +49,11 @@ init_per_suite(Config) -> <<"principal">> => <<"all">>, <<"sql">> => <<"abcb">>, <<"type">> => <<"mysql">> }], - {ok, _, _} = emqx_authz:update(replace, Rules), + {ok, _} = emqx_authz:update(replace, Rules), Config. end_per_suite(_Config) -> - {ok, _, _} = emqx_authz:update(replace, []), + {ok, _} = emqx_authz:update(replace, []), emqx_ct_helpers:stop_apps([emqx_authz, emqx_resource]), meck:unload(emqx_resource). diff --git a/apps/emqx_authz/test/emqx_authz_pgsql_SUITE.erl b/apps/emqx_authz/test/emqx_authz_pgsql_SUITE.erl index 85e8a360a..7f7c236d0 100644 --- a/apps/emqx_authz/test/emqx_authz_pgsql_SUITE.erl +++ b/apps/emqx_authz/test/emqx_authz_pgsql_SUITE.erl @@ -35,8 +35,8 @@ init_per_suite(Config) -> ok = emqx_ct_helpers:start_apps([emqx_authz]), - {ok, _, _} = emqx:update_config([zones, default, authorization, cache, enable], false), - {ok, _, _} = emqx:update_config([zones, default, authorization, enable], true), + {ok, _} = emqx:update_config([zones, default, authorization, cache, enable], false), + {ok, _} = emqx:update_config([zones, default, authorization, enable], true), Rules = [#{ <<"config">> => #{ <<"server">> => <<"127.0.0.1:27017">>, <<"pool_size">> => 1, @@ -48,11 +48,11 @@ init_per_suite(Config) -> }, <<"sql">> => <<"abcb">>, <<"type">> => <<"pgsql">> }], - {ok, _, _} = emqx_authz:update(replace, Rules), + {ok, _} = emqx_authz:update(replace, Rules), Config. end_per_suite(_Config) -> - {ok, _, _} = emqx_authz:update(replace, []), + {ok, _} = emqx_authz:update(replace, []), emqx_ct_helpers:stop_apps([emqx_authz, emqx_resource]), meck:unload(emqx_resource). diff --git a/apps/emqx_authz/test/emqx_authz_redis_SUITE.erl b/apps/emqx_authz/test/emqx_authz_redis_SUITE.erl index cf0694449..f0a571dd8 100644 --- a/apps/emqx_authz/test/emqx_authz_redis_SUITE.erl +++ b/apps/emqx_authz/test/emqx_authz_redis_SUITE.erl @@ -35,8 +35,8 @@ init_per_suite(Config) -> ok = emqx_ct_helpers:start_apps([emqx_authz]), - {ok, _, _} = emqx:update_config([zones, default, authorization, cache, enable], false), - {ok, _, _} = emqx:update_config([zones, default, authorization, enable], true), + {ok, _} = emqx:update_config([zones, default, authorization, cache, enable], false), + {ok, _} = emqx:update_config([zones, default, authorization, enable], true), Rules = [#{ <<"config">> => #{ <<"server">> => <<"127.0.0.1:27017">>, <<"pool_size">> => 1, @@ -47,11 +47,11 @@ init_per_suite(Config) -> }, <<"cmd">> => <<"HGETALL mqtt_authz:%u">>, <<"type">> => <<"redis">> }], - {ok, _, _} = emqx_authz:update(replace, Rules), + {ok, _} = emqx_authz:update(replace, Rules), Config. end_per_suite(_Config) -> - {ok, _, _} = emqx_authz:update(replace, []), + {ok, _} = emqx_authz:update(replace, []), emqx_ct_helpers:stop_apps([emqx_authz, emqx_resource]), meck:unload(emqx_resource). diff --git a/apps/emqx_data_bridge/src/emqx_data_bridge_api.erl b/apps/emqx_data_bridge/src/emqx_data_bridge_api.erl index 2039ab61f..dea3dcae8 100644 --- a/apps/emqx_data_bridge/src/emqx_data_bridge_api.erl +++ b/apps/emqx_data_bridge/src/emqx_data_bridge_api.erl @@ -124,7 +124,7 @@ format_api_reply(#{resource_type := Type, id := Id, config := Conf, status := St update_config_and_reply(Name, BridgeType, Config, Data) -> case emqx_data_bridge:update_config({update, ?BRIDGE(Name, BridgeType, Config)}) of - {ok, _, _} -> + {ok, _} -> {200, #{code => 0, data => format_api_reply( emqx_resource_api:format_data(Data))}}; {error, Reason} -> @@ -133,7 +133,7 @@ update_config_and_reply(Name, BridgeType, Config, Data) -> delete_config_and_reply(Name) -> case emqx_data_bridge:update_config({delete, Name}) of - {ok, _, _} -> {200, #{code => 0, data => #{}}}; + {ok, _} -> {200, #{code => 0, data => #{}}}; {error, Reason} -> {500, #{code => 102, message => emqx_resource_api:stringnify(Reason)}} end. diff --git a/apps/emqx_data_bridge/src/emqx_data_bridge_app.erl b/apps/emqx_data_bridge/src/emqx_data_bridge_app.erl index 26128841b..859952480 100644 --- a/apps/emqx_data_bridge/src/emqx_data_bridge_app.erl +++ b/apps/emqx_data_bridge/src/emqx_data_bridge_app.erl @@ -32,12 +32,12 @@ stop(_State) -> %% internal functions pre_config_update({update, Bridge = #{<<"name">> := Name}}, OldConf) -> - [Bridge | remove_bridge(Name, OldConf)]; + {ok, [Bridge | remove_bridge(Name, OldConf)]}; pre_config_update({delete, Name}, OldConf) -> - remove_bridge(Name, OldConf); + {ok, remove_bridge(Name, OldConf)}; pre_config_update(NewConf, _OldConf) when is_list(NewConf) -> %% overwrite the entire config! - NewConf. + {ok, NewConf}. remove_bridge(_Name, undefined) -> []; diff --git a/apps/emqx_management/src/emqx_mgmt_api_configs.erl b/apps/emqx_management/src/emqx_mgmt_api_configs.erl index 9a647e174..2c01276ce 100644 --- a/apps/emqx_management/src/emqx_mgmt_api_configs.erl +++ b/apps/emqx_management/src/emqx_mgmt_api_configs.erl @@ -113,7 +113,7 @@ config(get, Req) -> config(put, Req) -> Path = conf_path(Req), - {ok, _, RawConf} = emqx:update_config(Path, http_body(Req), + {ok, #{raw_config := RawConf}} = emqx:update_config(Path, http_body(Req), #{rawconf_with_defaults => true}), {200, emqx_map_lib:deep_get(Path, emqx_map_lib:jsonable_map(RawConf))}. @@ -121,7 +121,7 @@ config_reset(post, Req) -> %% reset the config specified by the query string param 'conf_path' Path = conf_path_reset(Req) ++ conf_path_from_querystr(Req), case emqx:reset_config(Path, #{}) of - {ok, _, _} -> {200}; + {ok, _} -> {200}; {error, Reason} -> {400, ?ERR_MSG(Reason)} end. diff --git a/apps/emqx_prometheus/src/emqx_prometheus_api.erl b/apps/emqx_prometheus/src/emqx_prometheus_api.erl index 15762f5de..63b8b6a10 100644 --- a/apps/emqx_prometheus/src/emqx_prometheus_api.erl +++ b/apps/emqx_prometheus/src/emqx_prometheus_api.erl @@ -113,7 +113,7 @@ prometheus(put, Request) -> {ok, Body, _} = cowboy_req:read_body(Request), Params = emqx_json:decode(Body, [return_maps]), Enable = maps:get(<<"enable">>, Params), - {ok, _, _} = emqx:update_config([prometheus], Params), + {ok, _} = emqx:update_config([prometheus], Params), enable_prometheus(Enable). % stats(_Bindings, Params) -> diff --git a/apps/emqx_statsd/src/emqx_statsd_api.erl b/apps/emqx_statsd/src/emqx_statsd_api.erl index 71e72d924..25f0d1879 100644 --- a/apps/emqx_statsd/src/emqx_statsd_api.erl +++ b/apps/emqx_statsd/src/emqx_statsd_api.erl @@ -91,7 +91,7 @@ statsd(put, Request) -> {ok, Body, _} = cowboy_req:read_body(Request), Params = emqx_json:decode(Body, [return_maps]), Enable = maps:get(<<"enable">>, Params), - {ok, _, _} = emqx:update_config([statsd], Params), + {ok, _} = emqx:update_config([statsd], Params), enable_statsd(Enable). enable_statsd(true) ->