Skip to content

Commit

Permalink
Add option to configure the include pattern for the vhost_enable dir
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdude authored and DavidS committed Oct 9, 2015
1 parent 932f0d0 commit 4c87d22
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,16 @@ Changes your virtual host configuration files' location. Default: determined by
- **Gentoo**: `/etc/apache2/vhosts.d`
- **Red Hat**: `/etc/httpd/conf.d`

##### `vhost_include_pattern`

Defines the pattern for files included from the `vhost_dir`. This defaults to '*', also for BC with previous versions of this module.

However, you may want to set this to a value like '[^.#]\*.conf[^~]' to make sure files accidentally created in this directory (from version
control systems, editor backups or the like) are *not* included in your server configuration.

A value of '*.conf' is what is shipped by some operating systems. Also note that this module will, by default, create config files ending
in '.conf'.

##### `user`

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.
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
$confd_dir = $::apache::params::confd_dir,
$vhost_dir = $::apache::params::vhost_dir,
$vhost_enable_dir = $::apache::params::vhost_enable_dir,
$vhost_include_pattern = $::apache::params::vhost_include_pattern,
$mod_dir = $::apache::params::mod_dir,
$mod_enable_dir = $::apache::params::mod_enable_dir,
$mpm_module = $::apache::params::mpm_module,
Expand Down
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
# should we use systemd module?
$use_systemd = true

$vhost_include_pattern = '*'

if $::operatingsystem == 'Ubuntu' and $::lsbdistrelease == '10.04' {
$verify_command = '/usr/sbin/apache2ctl -t'
} else {
Expand Down
4 changes: 2 additions & 2 deletions templates/httpd.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ Include "<%= @confd_dir %>/*.conf"
<%- end -%>
<% if @vhost_load_dir != @confd_dir -%>
<%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%>
IncludeOptional "<%= @vhost_load_dir %>/*"
IncludeOptional "<%= @vhost_load_dir %>/<%= @vhost_include_pattern %>"
<%- else -%>
Include "<%= @vhost_load_dir %>/*"
Include "<%= @vhost_load_dir %>/<%= @vhost_include_pattern %>"
<%- end -%>
<% end -%>

Expand Down

0 comments on commit 4c87d22

Please sign in to comment.