Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add expires directive to location #924

Merged
merged 2 commits into from
Oct 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,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 @@ -190,8 +191,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 @@ -338,6 +340,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