Merge pull request #13458 from lafirest/fix/banned_bf
fix(banned): let the bootfile of banned be optional
This commit is contained in:
commit
4e3095b1c4
|
@ -240,7 +240,7 @@ who(peerhost_net, CIDR) when is_binary(CIDR) ->
|
|||
%%--------------------------------------------------------------------
|
||||
%% Import From CSV
|
||||
%%--------------------------------------------------------------------
|
||||
init_from_csv(<<>>) ->
|
||||
init_from_csv(undefined) ->
|
||||
ok;
|
||||
init_from_csv(File) ->
|
||||
maybe
|
||||
|
@ -365,7 +365,9 @@ init([]) ->
|
|||
{ok, ensure_expiry_timer(#{expiry_timer => undefined}), {continue, init_from_csv}}.
|
||||
|
||||
handle_continue(init_from_csv, State) ->
|
||||
File = emqx_schema:naive_env_interpolation(emqx:get_config([banned, bootstrap_file], <<>>)),
|
||||
File = emqx_schema:naive_env_interpolation(
|
||||
emqx:get_config([banned, bootstrap_file], undefined)
|
||||
),
|
||||
_ = init_from_csv(File),
|
||||
{noreply, State}.
|
||||
|
||||
|
|
|
@ -1777,7 +1777,7 @@ fields("banned") ->
|
|||
binary(),
|
||||
#{
|
||||
desc => ?DESC("banned_bootstrap_file"),
|
||||
default => <<>>
|
||||
require => false
|
||||
}
|
||||
)}
|
||||
].
|
||||
|
@ -3355,8 +3355,6 @@ default_listener(SSLListener) ->
|
|||
%% otherwise always return string.
|
||||
naive_env_interpolation(undefined) ->
|
||||
undefined;
|
||||
naive_env_interpolation(<<>>) ->
|
||||
<<>>;
|
||||
naive_env_interpolation(Bin) when is_binary(Bin) ->
|
||||
naive_env_interpolation(unicode:characters_to_list(Bin, utf8));
|
||||
naive_env_interpolation("$" ++ Maybe = Original) ->
|
||||
|
|
Loading…
Reference in New Issue