forked from wryobservations/rummager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ru
44 lines (33 loc) · 1.2 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
app_path = File.dirname(__FILE__)
$:.unshift(app_path) unless $:.include?(app_path)
# Raindrops is only loaded when running under Unicorn so we need the conditional
# to prevent an undefined constant error.
#
# This middleware adds a /_raindrops path that exposes stats. To see this in
# development, start the app like this instead of the usual running under thin:
# bundle exec unicorn -l 3009
if defined?(Raindrops)
use Raindrops::Middleware, :stats => $stats
end
require "env"
require "bundler"
Bundler.require(:default, ENV['RACK_ENV'])
require "logger"
require "app"
in_development = ENV['RACK_ENV'] == 'development'
if in_development
set :logging, $DEBUG ? Logger::DEBUG : Logger::INFO
else
enable :logging
log = File.new("log/production.log", "a")
log.sync = true
STDOUT.reopen(log)
STDERR.reopen(log)
use Rack::Logstasher::Logger,
Logger.new("log/production.json.log"),
:extra_request_headers => { "GOVUK-Request-Id" => "govuk_request_id", "x-varnish" => "varnish_id" }
end
# Stop double slashes in URLs (even escaped ones) being flattened to single ones
set :protection, :except => [:path_traversal, :escaped_params, :frame_options]
enable :dump_errors, :raise_errors
run Rummager