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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 547dbd721c4caff313db4e3c9e48669de9f036e83b78432e3b691eef100ca0a6
4
- data.tar.gz: dbed45238f4b0c4a9026ae1b0575ed00c904035640ed17b3b1c295fd5f56ab7f
3
+ metadata.gz: a275e460e929db3791b73f3acd52d036641d4128212ee4803dc9a16788d49ea4
4
+ data.tar.gz: 0cebd0272eb7b8d03c443deec4f77a4e771f24c40e5536f01ff438af2d392a23
5
5
  SHA512:
6
- metadata.gz: 03fb63ab206a49a852b650bf8f0e80db431fb29ad4b778d804d6fe5f0a93abeae2a3ffe6985c5742818328ebae82ce7f5a23670781d5c695fb9794f8aee69586
7
- data.tar.gz: 05f26b6f89bbf8dcfde70ae563f7e7edaee52e72e57113872e4c6082fc952f791b7b9dbc26bdb7c7c28418fcb3973b8896f330d29ac034027832a386ad4f87a3
6
+ metadata.gz: e47bfd076e689fd4f35f9b5f8f1e9e25545d9a89092628507f2d0bebf00fd594d12d797460015f4c94dd32df589100beca9ed3184966a9778480c73f24d52640
7
+ data.tar.gz: 5f30e6b1da95f03200f0d0ab83e27cd48b1557a1446dccb5567490af7d951654b7294e31b4a622134e8fbd20e752c07836b4bdb1267775180cc03ffc462c5884
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rx-healthcheck (0.1.1)
4
+ rx-healthcheck (0.1.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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["REQUEST_PATH"]
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?(env)
61
- %w[/liveness /readiness /deep].include?(env["REQUEST_PATH"])
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rx
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
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.3
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-05-26 00:00:00.000000000 Z
11
+ date: 2021-07-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: