fix(rule): use emqx_conf:update/3 to make changes to all nodes
This commit is contained in:
parent
ea2d4674df
commit
a42ab3d9da
|
@ -172,7 +172,7 @@ param_path_id() ->
|
||||||
{ok, _Rule} ->
|
{ok, _Rule} ->
|
||||||
{400, #{code => 'BAD_ARGS', message => <<"rule id already exists">>}};
|
{400, #{code => 'BAD_ARGS', message => <<"rule id already exists">>}};
|
||||||
not_found ->
|
not_found ->
|
||||||
case emqx:update_config(ConfPath, Params, #{}) of
|
case emqx_conf:update(ConfPath, Params, #{}) of
|
||||||
{ok, #{post_config_update := #{emqx_rule_engine := AllRules}}} ->
|
{ok, #{post_config_update := #{emqx_rule_engine := AllRules}}} ->
|
||||||
[Rule] = get_one_rule(AllRules, Id),
|
[Rule] = get_one_rule(AllRules, Id),
|
||||||
{201, format_rule_resp(Rule)};
|
{201, format_rule_resp(Rule)};
|
||||||
|
@ -200,7 +200,7 @@ param_path_id() ->
|
||||||
'/rules/:id'(put, #{bindings := #{id := Id}, body := Params0}) ->
|
'/rules/:id'(put, #{bindings := #{id := Id}, body := Params0}) ->
|
||||||
Params = filter_out_request_body(Params0),
|
Params = filter_out_request_body(Params0),
|
||||||
ConfPath = emqx_rule_engine:config_key_path() ++ [Id],
|
ConfPath = emqx_rule_engine:config_key_path() ++ [Id],
|
||||||
case emqx:update_config(ConfPath, Params, #{}) of
|
case emqx_conf:update(ConfPath, Params, #{}) of
|
||||||
{ok, #{post_config_update := #{emqx_rule_engine := AllRules}}} ->
|
{ok, #{post_config_update := #{emqx_rule_engine := AllRules}}} ->
|
||||||
[Rule] = get_one_rule(AllRules, Id),
|
[Rule] = get_one_rule(AllRules, Id),
|
||||||
{200, format_rule_resp(Rule)};
|
{200, format_rule_resp(Rule)};
|
||||||
|
|
Loading…
Reference in New Issue