Merge pull request #578 from brunoleon/maintenance
feat: add an easy maintenance page support
This commit is contained in:
commit
82bda98f22
3 changed files with 17 additions and 0 deletions
|
@ -231,6 +231,7 @@ define nginx::resource::vhost (
|
|||
$owner = $::nginx::config::global_owner,
|
||||
$group = $::nginx::config::global_group,
|
||||
$mode = $::nginx::config::global_mode,
|
||||
$maintenance = false,
|
||||
) {
|
||||
|
||||
validate_re($ensure, '^(present|absent)$',
|
||||
|
|
|
@ -102,6 +102,14 @@ server {
|
|||
add_header <%= key %> <%= @add_header[key] %>;
|
||||
<%- end -%>
|
||||
<% end -%>
|
||||
<% if @maintenance -%>
|
||||
set $maintenance "on";
|
||||
<% else -%>
|
||||
set $maintenance "off";
|
||||
<% end -%>
|
||||
if ($maintenance = "on") {
|
||||
return 503;
|
||||
}
|
||||
<% if @rewrite_to_https -%>
|
||||
if ($ssl_protocol = "") {
|
||||
return 301 https://$host<% if @ssl_port.to_i != 443 %>:<%= @ssl_port %><% end %>$request_uri;
|
||||
|
|
|
@ -72,6 +72,14 @@ server {
|
|||
<%- end -%>
|
||||
|
||||
<% end -%>
|
||||
<% if @maintenance -%>
|
||||
set $maintenance "on";
|
||||
<% else -%>
|
||||
set $maintenance "off";
|
||||
<% end -%>
|
||||
if ($maintenance = "on") {
|
||||
return 503;
|
||||
}
|
||||
<% if Array(@resolver).count > 0 -%>
|
||||
resolver <% Array(@resolver).each do |r| %> <%= r %><% end %>;
|
||||
<% end -%>
|
||||
|
|
Loading…
Reference in a new issue