-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ru
44 lines (35 loc) · 1.16 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
# This file is used by Rack-based servers to start the application.
require File.expand_path('config/boot', __dir__)
# Exceptions handler
use Honeybadger::Rack::ErrorNotifier
if ENV['RACK_ENV'] == 'production'
require 'rack/ssl'
use Rack::SSL
end
# redis-activesupport is not compatible with activesupport 4 yet...
# see https://github.com/jodosha/redis-store/issues/160
#
# require 'rack/attack'
# require 'redis-activesupport'
# use Rack::Attack
# ActiveSupport::Cache.lookup_store :redis_store
# Rack::Attack.cache.store = ActiveSupport::Cache::RedisStore.new
# Rack::Attack.throttle('req/ip', limit: 5_000, period: 1.hour) do |req|
# req.ip
# end
# Metrics
require 'librato-rack'
use Librato::Rack, config: Librato::Rack::Configuration.new
# Sets an 'Etag' and 'Cache-Control' response headers
use Rack::ETag
# Sets an 'X-Runtime' response header
use Rack::Runtime
require 'rack/status'
use Rack::Status
# Application setup
require 'api/engine'
run SublimeVideo::API::Engine
# Display the middleware stack (run `be rackup` to see it)
if ENV['RACK_ENV'] == 'development'
$logger.info "Middleware stack:\n#{@use.inject('') { |a,e| a << "#{e.call.class}\n" }}"
end