fix(rules): store rule configs to cluster config files
This commit is contained in:
parent
869dc1a081
commit
93c5fa60b4
|
@ -207,7 +207,7 @@ param_path_id() ->
|
|||
{ok, _Rule} ->
|
||||
{400, #{code => 'BAD_REQUEST', message => <<"rule id already exists">>}};
|
||||
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}}} ->
|
||||
[Rule] = get_one_rule(AllRules, Id),
|
||||
{201, format_rule_resp(Rule)};
|
||||
|
@ -238,7 +238,7 @@ param_path_id() ->
|
|||
'/rules/:id'(put, #{bindings := #{id := Id}, body := Params0}) ->
|
||||
Params = filter_out_request_body(Params0),
|
||||
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}}} ->
|
||||
[Rule] = get_one_rule(AllRules, Id),
|
||||
{200, format_rule_resp(Rule)};
|
||||
|
@ -250,7 +250,7 @@ param_path_id() ->
|
|||
|
||||
'/rules/:id'(delete, #{bindings := #{id := 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};
|
||||
{error, Reason} ->
|
||||
?SLOG(error, #{msg => "delete_rule_failed",
|
||||
|
|
Loading…
Reference in New Issue