wet-health_endpoint 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/wet/health_endpoint/middleware.rb +21 -0
- data/lib/wet/health_endpoint/railtie.rb +4 -4
- data/lib/wet/health_endpoint/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67ce805651db910c46de290c86cf856282983b0b
|
4
|
+
data.tar.gz: 9c3f6e397ff49531404b2ad67a7a2f01cb05ec85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3382e626db6e3ef620735a9a0b31012a9b1e44a80044d20727895a4ff1bfceded80eb7dae1ee6e9def4221b37a44d59b8c50e505f434184036b819a4a35e4c2f
|
7
|
+
data.tar.gz: 669611999303c3da4ee340d2b1b29c2fbb97cdf1b68d77b52686a868877d4439bca8611eadc4ebc8b6eeb0e99d838c62bc1302d997be6729b824729808ad3cc4
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Wet::HealthEndpoint
|
2
2
|
|
3
|
-
|
3
|
+
[![Build Status](https://travis-ci.org/wetrb/wet-health_endpoint.svg?branch=master)](https://travis-ci.org/wetrb/wet-health_endpoint)
|
4
|
+
|
5
|
+
Adds `/health` endpoint to Rails app so it can be monitored.
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Wet
|
2
|
+
module HealthEndpoint
|
3
|
+
class Middleware
|
4
|
+
def initialize(app)
|
5
|
+
@app = app
|
6
|
+
end
|
7
|
+
|
8
|
+
def call(env)
|
9
|
+
dup._call(env)
|
10
|
+
end
|
11
|
+
|
12
|
+
def _call(env)
|
13
|
+
status, headers, body = @app.call(env)
|
14
|
+
return [204, {}, ['']] if status == 404 && env.fetch('PATH_INFO') == '/health'
|
15
|
+
[status, headers, body]
|
16
|
+
ensure
|
17
|
+
body.close if body && body.respond_to?(:close) && $!
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
|
+
require 'wet/health_endpoint/middleware'
|
2
|
+
|
1
3
|
module Wet
|
2
4
|
module HealthEndpoint
|
3
5
|
class Railtie < Rails::Railtie
|
4
|
-
initializer 'health_endpoint.routes'
|
5
|
-
app.
|
6
|
-
get '/health', to: proc { [204, {}, ['']] }
|
7
|
-
end
|
6
|
+
initializer 'health_endpoint.routes' do |app|
|
7
|
+
app.middleware.use Middleware
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wet-health_endpoint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Szymon Fiedler
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- bin/console
|
97
97
|
- bin/setup
|
98
98
|
- lib/wet/health_endpoint.rb
|
99
|
+
- lib/wet/health_endpoint/middleware.rb
|
99
100
|
- lib/wet/health_endpoint/railtie.rb
|
100
101
|
- lib/wet/health_endpoint/version.rb
|
101
102
|
- wet-health_endpoint.gemspec
|