|
@@ -207,7 +207,7 @@ param_path_id() ->
|
|
|
{ok, _Rule} ->
|
|
{ok, _Rule} ->
|
|
|
{400, #{code => 'BAD_REQUEST', message => <<"rule id already exists">>}};
|
|
{400, #{code => 'BAD_REQUEST', message => <<"rule id already exists">>}};
|
|
|
not_found ->
|
|
not_found ->
|
|
|
- case emqx_conf:update(ConfPath, Params, #{}) of
|
|
|
|
|
|
|
+ case emqx_conf:update(ConfPath, Params, #{override_to => cluster}) 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)};
|
|
@@ -238,7 +238,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_conf:update(ConfPath, Params, #{}) of
|
|
|
|
|
|
|
+ case emqx_conf:update(ConfPath, Params, #{override_to => cluster}) 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)};
|
|
@@ -250,7 +250,7 @@ param_path_id() ->
|
|
|
|
|
|
|
|
'/rules/:id'(delete, #{bindings := #{id := Id}}) ->
|
|
'/rules/:id'(delete, #{bindings := #{id := Id}}) ->
|
|
|
ConfPath = emqx_rule_engine:config_key_path() ++ [Id],
|
|
ConfPath = emqx_rule_engine:config_key_path() ++ [Id],
|
|
|
- case emqx_conf:remove(ConfPath, #{}) of
|
|
|
|
|
|
|
+ case emqx_conf:remove(ConfPath, #{override_to => cluster}) of
|
|
|
{ok, _} -> {204};
|
|
{ok, _} -> {204};
|
|
|
{error, Reason} ->
|
|
{error, Reason} ->
|
|
|
?SLOG(error, #{msg => "delete_rule_failed",
|
|
?SLOG(error, #{msg => "delete_rule_failed",
|