Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify data types and array handling #2457

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions manifests/mod/remoteip.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
#
class apache::mod::remoteip (
String $header = 'X-Forwarded-For',
Optional[Array[Variant[Stdlib::Host,Stdlib::IP::Address]]] $internal_proxy = undef,
Optional[Array[Variant[Stdlib::Host,Stdlib::IP::Address]]] $proxy_ips = undef,
Optional[Array[Stdlib::IP::Address]] $internal_proxy = undef,
Optional[Array[Stdlib::IP::Address]] $proxy_ips = undef,
Comment on lines +54 to +55
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, "The type Stdlib::Host includes Stdlib::IP::Address", was it not supposed to be the other way around?

  Optional[Array[Stdlib::Host]]                              $internal_proxy            = undef,
  Optional[Array[Stdlib::Host]]                              $proxy_ips                 = undef,

🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bleh, that's what you get for quickly doing the work.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional[Stdlib::Absolutepath] $internal_proxy_list = undef,
Optional[String] $proxies_header = undef,
Boolean $proxy_protocol = false,
Optional[Array[Variant[Stdlib::Host,Stdlib::IP::Address]]] $proxy_protocol_exceptions = undef,
Optional[Array[Stdlib::IP::Address]] $proxy_protocol_exceptions = undef,
Optional[Array[Stdlib::Host]] $trusted_proxy = undef,
Optional[Array[Stdlib::Host]] $trusted_proxy_ips = undef,
Optional[Stdlib::Absolutepath] $trusted_proxy_list = undef,
Expand Down
10 changes: 5 additions & 5 deletions templates/mod/remoteip.conf.epp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<%- |
String $header,
Optional[Array[Variant[Stdlib::Host,Stdlib::IP::Address]]] $internal_proxy = undef,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the template used anywhere where the Variant type is used as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional[Array[Stdlib::Host]] $internal_proxy = undef,
Optional[Stdlib::Absolutepath] $internal_proxy_list = undef,
Optional[String] $proxies_header = undef,
Boolean $proxy_protocol = undef,
Optional[Array[Variant[Stdlib::Host,Stdlib::IP::Address]]] $proxy_protocol_exceptions = undef,
Optional[Array[Stdlib::Host]] $proxy_protocol_exceptions = undef,
Optional[Array[Stdlib::IP::Address]] $trusted_proxy = undef,
Optional[Stdlib::Absolutepath] $trusted_proxy_list = undef,
| -%>
Expand All @@ -14,7 +14,7 @@ RemoteIPHeader <%= $header %>
<%- if $internal_proxy { -%>
# Declare client intranet IP addresses trusted to present
# the RemoteIPHeader value
<%- [$internal_proxy].flatten.each |$proxy| { -%>
<%- $internal_proxy.each |$proxy| { -%>
RemoteIPInternalProxy <%= $proxy %>
<%- } -%>
<%- } -%>
Expand All @@ -33,15 +33,15 @@ RemoteIPProxyProtocol On
<%- } -%>

<%- if $proxy_protocol_exceptions { -%>
<%- [$proxy_protocol_exceptions].flatten.each |$exception| { -%>
<%- $proxy_protocol_exceptions.each |$exception| { -%>
RemoteIPProxyProtocolExceptions <%= $exception %>
<%- } -%>
<%- } -%>

<%- if $trusted_proxy { -%>
# Declare client intranet IP addresses trusted to present
# the RemoteIPHeader value
<%- [$trusted_proxy].flatten.each |$proxy| { -%>
<%- $trusted_proxy.each |$proxy| { -%>
RemoteIPTrustedProxy <%= $proxy %>
<%- } -%>
<%- } -%>
Expand Down