-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathconfig.ru
More file actions
29 lines (26 loc) · 764 Bytes
/
config.ru
File metadata and controls
29 lines (26 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true
if ENV["MAINTENANCE_MODE"] == "ON"
use Rack::Static, urls: [ "/maintenance.html" ], root: "public"
run lambda { |env|
case env["PATH_INFO"] # request path
when "/up"
[
200, # HTTP status code for OK
{ "Content-Type" => "text/plain", "Content-Length" => "2" },
[ "OK" ]
]
else
[
503, # HTTP status code for Service Unavailable
{ "Content-Type" => "text/html", "Content-Length" => ::File.size("public/maintenance.html").to_s },
[ ::File.read("public/maintenance.html") ]
]
end
}
else
# Fallback to the usual Rails app
require_relative "config/environment"
use Rack::Status
run Rails.application
Rails.application.load_server
end