Skip to content

Instantly share code, notes, and snippets.

@myronmarston
Created January 2, 2012 18:40
Show Gist options
  • Save myronmarston/1551669 to your computer and use it in GitHub Desktop.
Save myronmarston/1551669 to your computer and use it in GitHub Desktop.
SiloRackApp = Rack::Builder.new do
use Rack::Runtime # add X-Runtime header
use E20::Ops::Middleware::RevisionMiddleware, logger: Silo.logger
use E20::Ops::Middleware::TransactionIdMiddleware, logger: Silo.logger
use E20::Ops::Middleware::HostnameMiddleware, logger: Silo.logger
use Clogger,
format: Clogger::Format::Combined,
path: File.join(Silo::ROOT, 'log', 'silo.access.log'),
reentrant: true
use Rack::ShowExceptions
# this must come after Rack::ShowExceptions so that it can handle
# exceptions before they propagates up to Rack::ShowExceptions.
# ShowJSONExceptions will render JSON error info unless the
# accepts header explicitly includes text/html (like for a browser)
use Silo::ShowJSONExceptions
Silo::NonTestMiddleware.configure(self)
use Silo::ContentNegotiation
use Silo::SocketResetMiddleware
map('/collector') { run Collector.new }
map('/events') { run EventFeed.new }
map('/manager') { run Manager.new }
map('/resque') { run Resque::Server.new }
map('/trigger_error') { run lambda { |env| raise "boom" } }
map('/heartbeat') { run Heartbeat.new }
Silo::TestServerEndpoints.configure(self)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment