Skip to content

Commit 4c87d22

Browse files
mpdudeDavidS
authored andcommitted
Add option to configure the include pattern for the vhost_enable dir
1 parent 932f0d0 commit 4c87d22

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,16 @@ Changes your virtual host configuration files' location. Default: determined by
11261126
- **Gentoo**: `/etc/apache2/vhosts.d`
11271127
- **Red Hat**: `/etc/httpd/conf.d`
11281128

1129+
##### `vhost_include_pattern`
1130+
1131+
Defines the pattern for files included from the `vhost_dir`. This defaults to '*', also for BC with previous versions of this module.
1132+
1133+
However, you may want to set this to a value like '[^.#]\*.conf[^~]' to make sure files accidentally created in this directory (from version
1134+
control systems, editor backups or the like) are *not* included in your server configuration.
1135+
1136+
A value of '*.conf' is what is shipped by some operating systems. Also note that this module will, by default, create config files ending
1137+
in '.conf'.
1138+
11291139
##### `user`
11301140

11311141
Changes the user Apache uses to answer requests. Apache's parent process will continue to be run as root, but child processes will access resources as the user defined by this parameter.

manifests/init.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
$confd_dir = $::apache::params::confd_dir,
4747
$vhost_dir = $::apache::params::vhost_dir,
4848
$vhost_enable_dir = $::apache::params::vhost_enable_dir,
49+
$vhost_include_pattern = $::apache::params::vhost_include_pattern,
4950
$mod_dir = $::apache::params::mod_dir,
5051
$mod_enable_dir = $::apache::params::mod_enable_dir,
5152
$mpm_module = $::apache::params::mpm_module,

manifests/params.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
# should we use systemd module?
3333
$use_systemd = true
3434

35+
$vhost_include_pattern = '*'
36+
3537
if $::operatingsystem == 'Ubuntu' and $::lsbdistrelease == '10.04' {
3638
$verify_command = '/usr/sbin/apache2ctl -t'
3739
} else {

templates/httpd.conf.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ Include "<%= @confd_dir %>/*.conf"
8585
<%- end -%>
8686
<% if @vhost_load_dir != @confd_dir -%>
8787
<%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%>
88-
IncludeOptional "<%= @vhost_load_dir %>/*"
88+
IncludeOptional "<%= @vhost_load_dir %>/<%= @vhost_include_pattern %>"
8989
<%- else -%>
90-
Include "<%= @vhost_load_dir %>/*"
90+
Include "<%= @vhost_load_dir %>/<%= @vhost_include_pattern %>"
9191
<%- end -%>
9292
<% end -%>
9393

0 commit comments

Comments
 (0)