chore(gw): rename functions

This commit is contained in:
JianBo He 2021-08-20 16:59:53 +08:00 committed by turtleDeng
parent eb8ec65162
commit f333a0b888
1 changed files with 4 additions and 4 deletions

View File

@ -105,7 +105,7 @@ init([Gateway, Ctx0, _GwDscrptr]) ->
end. end.
do_init_context(GwName, RawConf, Ctx) -> do_init_context(GwName, RawConf, Ctx) ->
Auth = case maps:get(authenticators, RawConf, #{enable => false}) of Auth = case maps:get(authenticator, RawConf, #{enable => false}) of
#{enable := false} -> undefined; #{enable := false} -> undefined;
AuthCfg when is_map(AuthCfg) -> AuthCfg when is_map(AuthCfg) ->
case maps:get(enable, AuthCfg, true) of case maps:get(enable, AuthCfg, true) of
@ -120,7 +120,7 @@ do_init_context(GwName, RawConf, Ctx) ->
Ctx#{auth => Auth}. Ctx#{auth => Auth}.
do_deinit_context(Ctx) -> do_deinit_context(Ctx) ->
cleanup_authenticators_for_gateway_insta(maps:get(auth, Ctx)), cleanup_authenticator_for_gateway_insta(maps:get(auth, Ctx)),
ok. ok.
handle_call(info, _From, State = #state{gw = Gateway}) -> handle_call(info, _From, State = #state{gw = Gateway}) ->
@ -240,9 +240,9 @@ create_authenticator_for_gateway_insta(GwName, AuthCfg) ->
throw({bad_chain, {ChainId, Reason}}) throw({bad_chain, {ChainId, Reason}})
end. end.
cleanup_authenticators_for_gateway_insta(undefined) -> cleanup_authenticator_for_gateway_insta(undefined) ->
ok; ok;
cleanup_authenticators_for_gateway_insta(ChainId) -> cleanup_authenticator_for_gateway_insta(ChainId) ->
case emqx_authn:delete_chain(ChainId) of case emqx_authn:delete_chain(ChainId) of
ok -> ok; ok -> ok;
{error, {not_found, _}} -> {error, {not_found, _}} ->