Skip to content

Commit

Permalink
Merge pull request #365 from rabbitt/feature/raw_prepend_and_append
Browse files Browse the repository at this point in the history
new raw_prepend / raw_append feature for vhosts & locations
  • Loading branch information
James Fryman committed Jun 27, 2014
2 parents 8203f55 + 7be12d0 commit 7490f39
Show file tree
Hide file tree
Showing 10 changed files with 811 additions and 523 deletions.
22 changes: 22 additions & 0 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
# for this location
# [*stub_status*] - If true it will point configure module
# stub_status to provide nginx stats on location
# [*raw_prepend*] - A single string, or an array of strings to
# prepend to the location directive (after custom_cfg directives). NOTE:
# YOU are responsible for a semicolon on each line that requires one.
# [*raw_append*] - A single string, or an array of strings to
# append to the location directive (after custom_cfg directives). NOTE:
# YOU are responsible for a semicolon on each line that requires one.
# [*location_custom_cfg*] - Expects a hash with custom directives, cannot
# be used with other location types (proxy, fastcgi, root, or stub_status)
# [*location_cfg_prepend*] - Expects a hash with extra directives to put
Expand Down Expand Up @@ -129,6 +135,8 @@
$location_deny = undef,
$option = undef,
$stub_status = undef,
$raw_prepend = undef,
$raw_append = undef,
$location_custom_cfg = undef,
$location_cfg_prepend = undef,
$location_cfg_append = undef,
Expand Down Expand Up @@ -201,6 +209,20 @@
if ($stub_status != undef) {
validate_bool($stub_status)
}
if ($raw_prepend != undef) {
if (is_array($raw_prepend)) {
validate_array($raw_prepend)
} else {
validate_string($raw_prepend)
}
}
if ($raw_append != undef) {
if (is_array($raw_append)) {
validate_array($raw_append)
} else {
validate_string($raw_append)
}
}
if ($location_custom_cfg != undef) {
validate_hash($location_custom_cfg)
}
Expand Down
48 changes: 47 additions & 1 deletion manifests/resource/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,22 @@
# [*auth_basic_user_file*] - This directive sets the htpasswd filename for
# the authentication realm.
# [*client_max_body_size*] - This directive sets client_max_body_size.
# [*client_body_timeout*] - Sets how long the server will wait for a
# [*client_body_timeout*] - Sets how long the server will wait for a
# client body. Default is 60s
# [*client_header_timeout*] - Sets how long the server will wait for a
# client header. Default is 60s
# [*raw_prepend*] - A single string, or an array of strings to
# prepend to the server directive (after cfg prepend directives). NOTE:
# YOU are responsible for a semicolon on each line that requires one.
# [*raw_append*] - A single string, or an array of strings to
# append to the server directive (after cfg append directives). NOTE:
# YOU are responsible for a semicolon on each line that requires one.
# [*location_raw_prepend*] - A single string, or an array of strings
# to prepend to the location directive (after custom_cfg directives). NOTE:
# YOU are responsible for a semicolon on each line that requires one.
# [*location_raw_append*] - A single string, or an array of strings
# to append to the location directive (after custom_cfg directives). NOTE:
# YOU are responsible for a semicolon on each line that requires one.
# [*vhost_cfg_append*] - It expects a hash with custom directives to
# put after everything else inside vhost
# [*vhost_cfg_prepend*] - It expects a hash with custom directives to
Expand Down Expand Up @@ -190,6 +202,10 @@
$client_body_timeout = undef,
$client_header_timeout = undef,
$client_max_body_size = undef,
$raw_prepend = undef,
$raw_append = undef,
$location_raw_prepend = undef,
$location_raw_append = undef,
$vhost_cfg_prepend = undef,
$vhost_cfg_append = undef,
$vhost_cfg_ssl_prepend = undef,
Expand Down Expand Up @@ -295,6 +311,34 @@
if ($rewrite_to_https != undef) {
validate_bool($rewrite_to_https)
}
if ($raw_prepend != undef) {
if (is_array($raw_prepend)) {
validate_array($raw_prepend)
} else {
validate_string($raw_prepend)
}
}
if ($raw_append != undef) {
if (is_array($raw_append)) {
validate_array($raw_append)
} else {
validate_string($raw_append)
}
}
if ($location_raw_prepend != undef) {
if (is_array($location_raw_prepend)) {
validate_array($location_raw_prepend)
} else {
validate_string($location_raw_prepend)
}
}
if ($location_raw_append != undef) {
if (is_array($location_raw_append)) {
validate_array($location_raw_append)
} else {
validate_string($location_raw_append)
}
}
if ($location_custom_cfg != undef) {
validate_hash($location_custom_cfg)
}
Expand Down Expand Up @@ -448,6 +492,8 @@
location_custom_cfg => $location_custom_cfg,
notify => Class['nginx::service'],
rewrite_rules => $rewrite_rules,
raw_prepend => $location_raw_prepend,
raw_append => $location_raw_append
}
$root = undef
} else {
Expand Down
Loading

0 comments on commit 7490f39

Please sign in to comment.