From e1bcbd012ca3aa3d7693ef1b53441a500741b61b Mon Sep 17 00:00:00 2001 From: zhouzb Date: Thu, 25 Nov 2021 11:11:38 +0800 Subject: [PATCH] feat(authn): support sync configuration in the cluster --- apps/emqx_authn/src/emqx_authn_api.erl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/emqx_authn/src/emqx_authn_api.erl b/apps/emqx_authn/src/emqx_authn_api.erl index 83ca9e56d..827b4e09c 100644 --- a/apps/emqx_authn/src/emqx_authn_api.erl +++ b/apps/emqx_authn/src/emqx_authn_api.erl @@ -793,9 +793,10 @@ add_user(ChainName, AuthenticatorID, #{<<"user_id">> := UserID, <<"password">> := Password} = UserInfo) -> IsSuperuser = maps:get(<<"is_superuser">>, UserInfo, false), - case emqx_authentication:add_user(ChainName, AuthenticatorID, #{ user_id => UserID - , password => Password - , is_superuser => IsSuperuser}) of + case emqx_authentication:add_user(ChainName, AuthenticatorID, + #{ user_id => UserID + , password => Password + , is_superuser => IsSuperuser}) of {ok, User} -> {201, User}; {error, Reason} -> @@ -845,7 +846,8 @@ list_users(ChainName, AuthenticatorID, PageParams) -> end. update_config(Path, ConfigRequest) -> - emqx:update_config(Path, ConfigRequest, #{rawconf_with_defaults => true}). + emqx_conf:update(Path, ConfigRequest, #{rawconf_with_defaults => true, + override_to => cluster}). get_raw_config_with_defaults(ConfKeyPath) -> NConfKeyPath = [atom_to_binary(Key, utf8) || Key <- ConfKeyPath],