Skip to content

Commit 9f9f32c

Browse files
committed
Avoid Optional[Array] = undef in remoteip.conf.erb
By defaulting to an empty array and handling that the code is simplified.
1 parent 4b316af commit 9f9f32c

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Diff for: templates/mod/remoteip.conf.epp

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<%- |
22
String $header,
3-
Optional[Array[Stdlib::Host]] $internal_proxy = undef,
3+
Array[Stdlib::Host] $internal_proxy = [],
44
Optional[Stdlib::Absolutepath] $internal_proxy_list = undef,
55
Optional[String] $proxies_header = undef,
66
Boolean $proxy_protocol = undef,
7-
Optional[Array[Stdlib::Host]] $proxy_protocol_exceptions = undef,
8-
Optional[Array[Stdlib::IP::Address]] $trusted_proxy = undef,
7+
Array[Stdlib::Host] $proxy_protocol_exceptions = [],
8+
Array[Stdlib::IP::Address] $trusted_proxy = [],
99
Optional[Stdlib::Absolutepath] $trusted_proxy_list = undef,
1010
| -%>
1111
# Declare the header field which should be parsed for useragent IP addresses
1212
RemoteIPHeader <%= $header %>
1313

14-
<%- if $internal_proxy { -%>
14+
<%- unless $internal_proxy.empty { -%>
1515
# Declare client intranet IP addresses trusted to present
1616
# the RemoteIPHeader value
1717
<%- $internal_proxy.each |$proxy| { -%>
@@ -32,13 +32,11 @@ RemoteIPProxiesHeader <%= $proxies_header %>
3232
RemoteIPProxyProtocol On
3333
<%- } -%>
3434

35-
<%- if $proxy_protocol_exceptions { -%>
36-
<%- $proxy_protocol_exceptions.each |$exception| { -%>
35+
<%- $proxy_protocol_exceptions.each |$exception| { -%>
3736
RemoteIPProxyProtocolExceptions <%= $exception %>
38-
<%- } -%>
3937
<%- } -%>
4038

41-
<%- if $trusted_proxy { -%>
39+
<%- unless $trusted_proxy.empty { -%>
4240
# Declare client intranet IP addresses trusted to present
4341
# the RemoteIPHeader value
4442
<%- $trusted_proxy.each |$proxy| { -%>

0 commit comments

Comments
 (0)