forked from librato/librato-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ru
45 lines (36 loc) · 1.11 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
require "rubygems"
require "bundler"
Bundler.require :default, :app
if ENV['REMOTE_SYSLOG_URI']
uri = URI.parse(ENV['REMOTE_SYSLOG_URI'])
logger = RemoteSyslogLogger::UdpSender.
new(uri.host, uri.port,
:local_hostname => "#{ENV['APP_NAME']}-#{ENV['PS']}")
use Rack::CommonLogger, logger
end
# Add exception tracking middleware here to catch
# all exceptions from the following middleware.
#
if ENV["ERRBIT_API_KEY"].to_s.length > 0
require "airbrake"
Airbrake.configure do |config|
config.api_key = ENV['ERRBIT_API_KEY']
config.host = ENV['ERRBIT_HOST']
config.environment_name = ENV['RACK_ENV']
config.port = 443
config.secure = config.port == 443
end
use Airbrake::Rack
elsif ENV["HONEYBADGER_API_KEY"].to_s.length > 0
require "honeybadger"
# Configure the API key
Honeybadger.configure do |config|
config.api_key = ENV["HONEYBADGER_API_KEY"]
config.ignore << 'Sinatra::NotFound'
end
# And use Honeybadger's rack middleware
use Honeybadger::Rack
end
$:.unshift File.join(File.dirname(__FILE__), 'lib')
require "librato-services"
run Librato::Services::App