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)
|
||||
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)
|
||||
|
||||
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
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user