1require 'health_check' |
|
3class HealthCheckMiddleware |
|
|
4 def initialize(app) |
5 @app = app |
|
6 end |
|
|
8 def call(env) |
9 if env['PATH_INFO'] =~ %r[\A/health-check/?\Z] |
|
10 [
|
|
11 200, |
|
12 {
|
|
13 'Content-Type' => 'application/json', |
|
14 },
|
|
15 [HealthCheck.checkup(env).to_json] |
|
16 ]
|
|
17 else |
|
18 @app.call(env) |
|
19 end |
|
20 end |
|
21end |