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

new raw_prepend / raw_append feature for vhosts & locations #364

Closed
Closed
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
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
46 changes: 46 additions & 0 deletions manifests/resource/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@
# [*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.
# [*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 @@ -183,6 +195,10 @@
$auth_basic = undef,
$auth_basic_user_file = 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 @@ -287,6 +303,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 @@ -431,6 +475,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