Skip to content

Commit f7bbcd1

Browse files
authored
Fix config name for the ip_allowlist, allow old ip_whitelist (#48)
1 parent 26ce21a commit f7bbcd1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/cowmachine_proxy.erl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ lower(C) -> C.
297297
Result :: boolean().
298298
is_trusted_proxy(Peer) ->
299299
case application:get_env(cowmachine, proxy_allowlist) of
300+
{ok, ip_whitelist} ->
301+
% Map old config name
302+
is_trusted_proxy(ip_allowlist, Peer);
300303
{ok, ProxyAllowlist} ->
301304
is_trusted_proxy(ProxyAllowlist, Peer);
302305
undefined ->
@@ -305,7 +308,7 @@ is_trusted_proxy(Peer) ->
305308

306309
-spec is_trusted_proxy(Marker, Peer) -> Result when
307310
Marker :: ProxyMarker | ProxyAllowlist,
308-
ProxyMarker :: any | ip_whitelist | local | none,
311+
ProxyMarker :: any | ip_allowlist | local | none,
309312
ProxyAllowlist :: list() | binary(),
310313
Peer :: inet:ip_address(),
311314
Result :: boolean().
@@ -315,7 +318,7 @@ is_trusted_proxy(any, _Peer) ->
315318
true;
316319
is_trusted_proxy(local, Peer) ->
317320
z_ip_address:is_local(Peer);
318-
is_trusted_proxy(ip_whitelist, Peer) ->
321+
is_trusted_proxy(ip_allowlist, Peer) ->
319322
case application:get_env(cowmachine, ip_allowlist) of
320323
{ok, Allowlist} ->
321324
z_ip_address:ip_match(Peer, Allowlist);

0 commit comments

Comments
 (0)