Created
November 16, 2015 11:16
-
-
Save sharshenov/33c0dd55c838ecd5762c to your computer and use it in GitHub Desktop.
Rails middleware for health check endpoint
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 HealthCheckResponder | |
def initialize(app, options = {}) | |
@app = app | |
end | |
def call(env) | |
if env["REQUEST_PATH"] == "/health_check" | |
return [200, {}, [""]] | |
else | |
@app.call(env) | |
end | |
end | |
end | |
config.middleware.insert_before "Rails::Rack::Logger", "HealthCheckResponder" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment