feat (maintenance): allow to specify maintenance behavior. Add docs.

This commit is contained in:
Bruno Léon 2015-03-24 15:45:29 +01:00
parent c18ba1d499
commit 6f1744b11d
3 changed files with 6 additions and 2 deletions

View file

@ -135,6 +135,9 @@
# [*owner*] - Defines owner of the .conf file
# [*group*] - Defines group of the .conf file
# [*mode*] - Defines mode of the .conf file
# [*maintenance*] - A boolean value to set a vhost in maintenance
# [*maintenance_value*] - Value to return when maintenance is on.
# Default to return 503
# Actions:
#
# Requires:
@ -232,6 +235,7 @@ define nginx::resource::vhost (
$group = $::nginx::config::global_group,
$mode = $::nginx::config::global_mode,
$maintenance = false,
$maintenance_value = 'return 503'
) {
validate_re($ensure, '^(present|absent)$',

View file

@ -108,7 +108,7 @@ server {
set $maintenance "off";
<% end -%>
if ($maintenance = "on") {
return 503;
<%= @maintenance_value %>;
}
<% if @rewrite_to_https -%>
if ($ssl_protocol = "") {

View file

@ -78,7 +78,7 @@ server {
set $maintenance "off";
<% end -%>
if ($maintenance = "on") {
return 503;
<%= @maintenance_value %>;
}
<% if Array(@resolver).count > 0 -%>
resolver <% Array(@resolver).each do |r| %> <%= r %><% end %>;