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:
parent
9b4f1ea667
commit
6a11c82551
1
.ruby-version
Normal file
1
.ruby-version
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.9.3-p374
|
||||||
@ -93,12 +93,12 @@ GEM
|
|||||||
polyglot (0.3.3)
|
polyglot (0.3.3)
|
||||||
powder (0.1.6)
|
powder (0.1.6)
|
||||||
thor (>= 0.11.5)
|
thor (>= 0.11.5)
|
||||||
rack (1.3.8)
|
rack (1.3.9)
|
||||||
rack-cache (1.2)
|
rack-cache (1.2)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
rack-mount (0.8.3)
|
rack-mount (0.8.3)
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
rack-ssl (1.3.2)
|
rack-ssl (1.3.3)
|
||||||
rack
|
rack
|
||||||
rack-test (0.6.2)
|
rack-test (0.6.2)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
|
|||||||
17
app/middleware/heartbeat.rb
Normal file
17
app/middleware/heartbeat.rb
Normal 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
|
||||||
@ -48,6 +48,9 @@ module DanBarberPhoto
|
|||||||
# Prefer SASS syntax for stylesheets
|
# Prefer SASS syntax for stylesheets
|
||||||
config.sass.preferred_syntax = :sass
|
config.sass.preferred_syntax = :sass
|
||||||
|
|
||||||
|
# Heartbeat
|
||||||
|
config.middleware.insert_before 0, 'Heartbeat'
|
||||||
|
|
||||||
# Rack Middleware
|
# Rack Middleware
|
||||||
config.middleware.use ::ExceptionNotifier, :email_prefix => "[DanBarberPhoto] ",
|
config.middleware.use ::ExceptionNotifier, :email_prefix => "[DanBarberPhoto] ",
|
||||||
:sender_address => %{"Exception Notification" <notifier@danbarberphoto.com>},
|
:sender_address => %{"Exception Notification" <notifier@danbarberphoto.com>},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user