1
0
mirror of https://github.com/danbee/danbarberphoto synced 2025-03-04 08:49:07 +00:00

Add Heartbeat middleware (thanks to @olivernn)

This commit is contained in:
Dan Barber 2013-01-31 08:34:11 +00:00
parent 9b4f1ea667
commit 6a11c82551
4 changed files with 25 additions and 4 deletions

1
.ruby-version Normal file
View File

@ -0,0 +1 @@
1.9.3-p374

View File

@ -93,12 +93,12 @@ GEM
polyglot (0.3.3)
powder (0.1.6)
thor (>= 0.11.5)
rack (1.3.8)
rack (1.3.9)
rack-cache (1.2)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-ssl (1.3.2)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)

View File

@ -0,0 +1,17 @@
class Heartbeat
def initialize(app)
@app = app
end
def call(env)
if env['PATH_INFO'] == '/heartbeat'
[
200,
{"Content-Type" => "text/plain"},
["OK"]
]
else
@app.call(env)
end
end
end

View File

@ -44,14 +44,17 @@ module DanBarberPhoto
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
# Prefer SASS syntax for stylesheets
config.sass.preferred_syntax = :sass
# Heartbeat
config.middleware.insert_before 0, 'Heartbeat'
# Rack Middleware
config.middleware.use ::ExceptionNotifier, :email_prefix => "[DanBarberPhoto] ",
:sender_address => %{"Exception Notification" <notifier@danbarberphoto.com>},
:exception_recipients => %w{dan@danbarberphoto.com}
end
end