-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.ru
64 lines (46 loc) · 1.14 KB
/
config.ru
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# frozen_string_literal: true
$stdout.sync = true
$stderr.sync = true
require_relative 'config/sentry'
use Sentry::Rack::CaptureExceptions
require 'rack/ssl-enforcer'
# Connects to the database
require_relative 'config/app'
if App.test_lowlevel_error_handler?
require_relative "lib/broken_app"
use BrokenApp
end
if App.redirect_to_https?
options = if App.development?
{ https_port: App.ssl_port, hsts: false }
else
{ hsts: { subdomains: false } }
end
use Rack::SslEnforcer, options
end
use Rack::Session::Cookie,
same_site: :lax,
secret: ENV.fetch('SESSION_SECRET'),
expire_after: 60 * 60 * 24 * 365
use Rack::Static, {
root: "public",
urls: ["/stylesheets", "/images", "/javascripts", "/favicon.ico", "/robots.txt"],
cache_control: "public,max-age=#{365 * 24 * 3600}"
}
map "/.backup" do
use Rack::Auth::Basic do |username, password|
App.backup_access?(username, password)
end
run BackupController
end
if App.maintenance_mode?
require_relative "lib/maintenance_mode_app"
use MaintenanceModeApp
end
map "/authorize" do
run AuthorizeController
end
map "/user" do
run UserController
end
run PageController