Skip to content

Instantly share code, notes, and snippets.

@scottwater
Last active January 24, 2017 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottwater/4c1aab86dcabbb747213023c019b253c to your computer and use it in GitHub Desktop.
Save scottwater/4c1aab86dcabbb747213023c019b253c to your computer and use it in GitHub Desktop.
Sample health check middleware for backplane.io
class BackplaneHealthCheck
OK_RESPONSE = [ 200, { 'Content-Type' => 'text/plain' }, ['OK!'.freeze]]
def initialize(app)
@app = app
end
def call(env)
if env['HTTP_HOST'.freeze] == 'backend'.freeze && env['PATH_INFO'.freeze] == '/health'.freeze
return OK_RESPONSE
else
@app.call(env)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment