Skip to content

Commit

Permalink
Merge pull request voxpupuli#924 from wyardley/feature_expires_snowmean
Browse files Browse the repository at this point in the history
Add expires directive to location
  • Loading branch information
jyaworski authored Oct 16, 2016
2 parents 582ac4c + afbb6a2 commit a2787a0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 7 additions & 2 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
# used for mp4 streaming. Default: false
# [*flv*] - Indicates whether or not this loation can be
# used for flv streaming. Default: false
# [*expires*] - Setup expires time for locations content
#
#
# Actions:
Expand Down Expand Up @@ -192,8 +193,9 @@
$auth_basic_user_file = undef,
$rewrite_rules = [],
$priority = 500,
$mp4 = false,
$flv = false,
$mp4 = false,
$flv = false,
$expires = undef,
) {

$root_group = $::nginx::config::root_group
Expand Down Expand Up @@ -341,6 +343,9 @@
if (($priority + 0) < 401) or (($priority + 0) > 899) {
fail('$priority must be in the range 401-899.')
}
if ($expires != undef) {
validate_string($expires)
}

# # Shared Variables
$ensure_real = $ensure ? {
Expand Down
6 changes: 6 additions & 0 deletions spec/defines/resource_location_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@
value: 'any',
match: ' satisfy any;'
},
{
title: 'should set expires',
attr: 'expires',
value: '33d',
match: ' expires 33d;'
},
{
title: 'should set location_allow',
attr: 'location_allow',
Expand Down
3 changes: 3 additions & 0 deletions templates/vhost/location_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<% if @location_satisfy -%>
satisfy <%= @location_satisfy -%>;
<% end -%>
<% if @expires -%>
expires <%= @expires %>;
<% end -%>
<% if @location_allow -%>
<%- @location_allow.each do |allow_rule| -%>
allow <%= allow_rule %>;
Expand Down

0 comments on commit a2787a0

Please sign in to comment.