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