File: expires.pp

package info (click to toggle)
puppet-module-puppetlabs-apache 12.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,664 kB
  • sloc: ruby: 275; sh: 32; makefile: 2
file content (44 lines) | stat: -rw-r--r-- 1,489 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# @summary
#   Installs and configures `mod_expires`.
# 
# @param expires_active
#   Enables generation of Expires headers.
#
# @param expires_default
#   Specifies the default algorithm for calculating expiration time using ExpiresByType syntax or interval syntax.
#
# @param expires_by_type
#   Describes a set of [MIME content-types](https://www.iana.org/assignments/media-types/media-types.xhtml) and their expiration
#   times. This should be used as an array of Hashes, with each Hash's key a valid MIME content-type (i.e. 'text/json') and its 
#   value following valid interval syntax.
#
# @see https://httpd.apache.org/docs/current/mod/mod_expires.html for additional documentation.
#
class apache::mod::expires (
  Boolean $expires_active                 = true,
  Optional[String] $expires_default       = undef,
  Optional[Array[Hash]] $expires_by_type  = undef,
) {
  include apache
  ::apache::mod { 'expires': }

  # Template uses
  # $expires_active
  # $expires_default
  # $expires_by_type
  $parameters = {
    'expires_active'  => $expires_active,
    'expires_default' => $expires_default,
    'expires_by_type' => $expires_by_type,
  }

  file { 'expires.conf':
    ensure  => file,
    path    => "${apache::mod_dir}/expires.conf",
    mode    => $apache::file_mode,
    content => epp('apache/mod/expires.conf.epp', $parameters),
    require => Exec["mkdir ${apache::mod_dir}"],
    before  => File[$apache::mod_dir],
    notify  => Class['apache::service'],
  }
}