Last active
January 24, 2017 14:40
-
-
Save scottwater/4c1aab86dcabbb747213023c019b253c to your computer and use it in GitHub Desktop.
Sample health check middleware for backplane.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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