|
1729 | 1729 | # When set to false (default), the existing behaviour of using the $name parameter |
1730 | 1730 | # will remain. |
1731 | 1731 | # |
| 1732 | +# @param $use_port_for_filenames |
| 1733 | +# When set to true and use_servername_for_filenames is also set to true, default log / |
| 1734 | +# config file names will be derived from the sanitized value of both the $servername and |
| 1735 | +# $port parameters. |
| 1736 | +# When set to false (default), the port is not included in the file names and may lead to |
| 1737 | +# duplicate declarations if two virtual hosts use the same domain. |
| 1738 | +# |
1732 | 1739 | # @param $mdomain |
1733 | 1740 | # All the names in the list are managed as one Managed Domain (MD). mod_md will request |
1734 | 1741 | # one single certificate that is valid for all these names. |
|
1800 | 1807 | $access_log_env_var = false, |
1801 | 1808 | Optional[Array] $access_logs = undef, |
1802 | 1809 | Optional[Boolean] $use_servername_for_filenames = false, |
| 1810 | + Optional[Boolean] $use_port_for_filenames = false, |
1803 | 1811 | $aliases = undef, |
1804 | 1812 | Optional[Variant[Hash, Array[Variant[Array,Hash]]]] $directories = undef, |
1805 | 1813 | Boolean $error_log = true, |
|
2064 | 2072 | # also perform some sanitiation on the $servername parameter to strip spaces from it, as it defaults to the value of |
2065 | 2073 | # $name, should $servername NOT be defined. |
2066 | 2074 | # |
| 2075 | + # Because a single hostname may be use by multiple virtual hosts listening on different ports, the $port paramter can |
| 2076 | + # optionaly be used to avoid duplicate resources. |
| 2077 | + # |
2067 | 2078 | # We will retain the default behaviour for filenames but allow the use of a sanitized version of $servername to be |
2068 | | - # used, using the new $use_servername_for_filenames parameter. |
| 2079 | + # used, using the new $use_servername_for_filenames and $use_port_for_filenames parameters. |
2069 | 2080 | # |
2070 | 2081 | # This will default to false until the next major release (v6.0.0), at which point, we will default this to true and |
2071 | 2082 | # warn about it's imminent deprecation in the subsequent major release (v7.0.0) |
2072 | 2083 | # |
2073 | | - # In v7.0.0, we will deprecate the $use_servername_for_filenames parameter altogether and use the sanitized value of |
2074 | | - # $servername for default log / config filenames. |
| 2084 | + # In v7.0.0, we will deprecate the $use_servername_for_filenames and $use_port_for_filenames parameters altogether |
| 2085 | + # and use the sanitized value of $servername for default log / config filenames. |
2075 | 2086 | $filename = $use_servername_for_filenames ? { |
2076 | | - true => regsubst($servername, ' ', '_', 'G'), |
| 2087 | + true => $use_port_for_filenames ? { |
| 2088 | + true => regsubst("${servername}-${port}", ' ', '_', 'G'), |
| 2089 | + false => regsubst($servername, ' ', '_', 'G'), |
| 2090 | + }, |
2077 | 2091 | false => $name, |
2078 | 2092 | } |
2079 | 2093 |
|
|
2088 | 2102 | module, the $use_servername_for_filenames will be removed and log/config file names will be dervied from the |
2089 | 2103 | sanitized $servername parameter when not explicitly defined.' |
2090 | 2104 | warning($use_servername_for_filenames_warn_msg) |
| 2105 | + } elsif ! $use_port_for_filenames { |
| 2106 | + $use_port_for_filenames_warn_msg = ' |
| 2107 | + It is possible for multiple virtual hosts to be configured using the same $servername but a different port. When |
| 2108 | + using $use_servername_for_filenames, this can lead to duplicate resource declarations. |
| 2109 | + When $use_port_for_filenames = true, the $servername and $port parameters, sanitized, are used to construct log and |
| 2110 | + config file names. |
| 2111 | +
|
| 2112 | + From version v6.0.0 of the puppetlabs-apache module, this parameter will default to true. From version v7.0.0 of the |
| 2113 | + module, the $use_port_for_filenames will be removed and log/config file names will be dervied from the |
| 2114 | + sanitized $servername parameter when not explicitly defined.' |
| 2115 | + warning($use_port_for_filenames_warn_msg) |
2091 | 2116 | } |
2092 | 2117 |
|
2093 | 2118 | # This ensures that the docroot exists |
|
0 commit comments