fix(authz): update the post_config_update callback

This commit is contained in:
Shawn 2021-07-30 15:12:48 +08:00
parent dc1ba51935
commit 054623bd56
2 changed files with 5 additions and 5 deletions

View File

@ -51,7 +51,7 @@
emqx_config:update_request().
-callback post_config_update(emqx_config:update_request(), emqx_config:config(),
emqx_config:config()) -> ok | {error, term()}.
emqx_config:config()) -> any().
-type state() :: #{
handlers := handlers(),
@ -94,7 +94,7 @@ handle_call({change_config, SchemaModule, ConfKeyPath, UpdateReq}, _From,
{NewRawConf, OverrideConf} = process_upadate_request(ConfKeyPath, OldRawConf,
Handlers, UpdateReq),
{AppEnvs, CheckedConf} = emqx_config:check_config(SchemaModule, NewRawConf),
do_post_config_update(ConfKeyPath, Handlers, OldConf, CheckedConf, UpdateReq),
_ = do_post_config_update(ConfKeyPath, Handlers, OldConf, CheckedConf, UpdateReq),
emqx_config:save_configs(AppEnvs, CheckedConf, NewRawConf, OverrideConf)
catch Error:Reason:ST ->
?LOG(error, "change_config failed: ~p", [{Error, Reason, ST}]),

View File

@ -31,7 +31,7 @@
, match/4
]).
-export([post_config_update/2, pre_config_update/2]).
-export([post_config_update/3, pre_config_update/2]).
-define(CONF_KEY_PATH, [authorization, rules]).
@ -63,10 +63,10 @@ pre_config_update({_, NewConf}, _OldConf) ->
false -> [NewConf]
end.
post_config_update(undefined, _OldConf) ->
post_config_update(_, undefined, _OldConf) ->
%_ = [release_rules(Rule) || Rule <- OldConf],
ok;
post_config_update(NewRules, _OldConf) ->
post_config_update(_, NewRules, _OldConf) ->
%_ = [release_rules(Rule) || Rule <- OldConf],
InitedRules = [init_rule(Rule) || Rule <- NewRules],
Action = find_action_in_hooks(),