rx-healthcheck 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rx/middleware.rb +8 -4
- data/lib/rx/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a275e460e929db3791b73f3acd52d036641d4128212ee4803dc9a16788d49ea4
|
4
|
+
data.tar.gz: 0cebd0272eb7b8d03c443deec4f77a4e771f24c40e5536f01ff438af2d392a23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e47bfd076e689fd4f35f9b5f8f1e9e25545d9a89092628507f2d0bebf00fd594d12d797460015f4c94dd32df589100beca9ed3184966a9778480c73f24d52640
|
7
|
+
data.tar.gz: 5f30e6b1da95f03200f0d0ab83e27cd48b1557a1446dccb5567490af7d951654b7294e31b4a622134e8fbd20e752c07836b4bdb1267775180cc03ffc462c5884
|
data/Gemfile.lock
CHANGED
data/lib/rx/middleware.rb
CHANGED
@@ -23,11 +23,11 @@ module Rx
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def call(env)
|
26
|
-
unless health_check_request?(env)
|
26
|
+
unless health_check_request?(path(env))
|
27
27
|
return app.call(env)
|
28
28
|
end
|
29
29
|
|
30
|
-
case env
|
30
|
+
case path(env)
|
31
31
|
when "/liveness"
|
32
32
|
ok = check_to_component(liveness_checks).map { |x| x[:status] == 200 }.all?
|
33
33
|
liveness_response(ok)
|
@@ -57,14 +57,18 @@ module Rx
|
|
57
57
|
Rx::Cache::InMemoryCache.new
|
58
58
|
end
|
59
59
|
|
60
|
-
def health_check_request?(
|
61
|
-
%w[/liveness /readiness /deep].include?(
|
60
|
+
def health_check_request?(path)
|
61
|
+
%w[/liveness /readiness /deep].include?(path)
|
62
62
|
end
|
63
63
|
|
64
64
|
def liveness_response(is_ok)
|
65
65
|
[is_ok ? 200 : 503, {}, []]
|
66
66
|
end
|
67
67
|
|
68
|
+
def path(env)
|
69
|
+
env["PATH_INFO"] || env["REQUEST_PATH"] || env["REQUEST_URI"]
|
70
|
+
end
|
71
|
+
|
68
72
|
def readiness_response(components)
|
69
73
|
status = components.map { |x| x[:status] == 200 }.all? ? 200 : 503
|
70
74
|
|
data/lib/rx/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rx-healthcheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Pendleton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|