fix(authz): update the post_config_update callback
This commit is contained in:
parent
dc1ba51935
commit
054623bd56
|
@ -51,7 +51,7 @@
|
||||||
emqx_config:update_request().
|
emqx_config:update_request().
|
||||||
|
|
||||||
-callback post_config_update(emqx_config:update_request(), emqx_config:config(),
|
-callback post_config_update(emqx_config:update_request(), emqx_config:config(),
|
||||||
emqx_config:config()) -> ok | {error, term()}.
|
emqx_config:config()) -> any().
|
||||||
|
|
||||||
-type state() :: #{
|
-type state() :: #{
|
||||||
handlers := handlers(),
|
handlers := handlers(),
|
||||||
|
@ -94,7 +94,7 @@ handle_call({change_config, SchemaModule, ConfKeyPath, UpdateReq}, _From,
|
||||||
{NewRawConf, OverrideConf} = process_upadate_request(ConfKeyPath, OldRawConf,
|
{NewRawConf, OverrideConf} = process_upadate_request(ConfKeyPath, OldRawConf,
|
||||||
Handlers, UpdateReq),
|
Handlers, UpdateReq),
|
||||||
{AppEnvs, CheckedConf} = emqx_config:check_config(SchemaModule, NewRawConf),
|
{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)
|
emqx_config:save_configs(AppEnvs, CheckedConf, NewRawConf, OverrideConf)
|
||||||
catch Error:Reason:ST ->
|
catch Error:Reason:ST ->
|
||||||
?LOG(error, "change_config failed: ~p", [{Error, Reason, ST}]),
|
?LOG(error, "change_config failed: ~p", [{Error, Reason, ST}]),
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
, match/4
|
, 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]).
|
-define(CONF_KEY_PATH, [authorization, rules]).
|
||||||
|
|
||||||
|
@ -63,10 +63,10 @@ pre_config_update({_, NewConf}, _OldConf) ->
|
||||||
false -> [NewConf]
|
false -> [NewConf]
|
||||||
end.
|
end.
|
||||||
|
|
||||||
post_config_update(undefined, _OldConf) ->
|
post_config_update(_, undefined, _OldConf) ->
|
||||||
%_ = [release_rules(Rule) || Rule <- OldConf],
|
%_ = [release_rules(Rule) || Rule <- OldConf],
|
||||||
ok;
|
ok;
|
||||||
post_config_update(NewRules, _OldConf) ->
|
post_config_update(_, NewRules, _OldConf) ->
|
||||||
%_ = [release_rules(Rule) || Rule <- OldConf],
|
%_ = [release_rules(Rule) || Rule <- OldConf],
|
||||||
InitedRules = [init_rule(Rule) || Rule <- NewRules],
|
InitedRules = [init_rule(Rule) || Rule <- NewRules],
|
||||||
Action = find_action_in_hooks(),
|
Action = find_action_in_hooks(),
|
||||||
|
|
Loading…
Reference in New Issue