rx-healthcheck 0.1.9 → 0.1.10

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: ebf9af8d3b43d1640503ddcba7138d1ef6c04f298faa09b39c8d93fcb0d4eb50
4
- data.tar.gz: e22f89c795207f5a3a78bb6f63c362624e6b4104e3834f6ca928ecb1c6fd5b79
3
+ metadata.gz: 825528f73f53ce6f4a0da5495543859293ee6688e23cf1b1365206738e02e420
4
+ data.tar.gz: 2b447c79ac8bed5bf4e3ee84fc19e1eda62575368d714b5eb4ea472fcb59ed77
5
5
  SHA512:
6
- metadata.gz: a194f56c544904474062a866aa7c91cfe6de9548b97802beaa448b4b082dab4c1fc3ffa7f41e3c0aa14b8f94c11d518e586d6984f1a82cbfaf0d2479abc9ce06
7
- data.tar.gz: 1fc1ea21c9586cb3583d25ab7c8ab7177d0789ec085cc4de316dd136ebeb3c03872f30c2b54293c2efd254ea5ebae6d0255d86816488020a584e7c1b8c8b39f9
6
+ metadata.gz: b10aa92da2efb24e41afc29637df1160c73e6af556be2a3db64d69949b8163c84a5a7b05c3050b52e2189231140669fdb94113554196cd7d2eaa5fa628e997f1
7
+ data.tar.gz: fa7b6088065d80115b39b844e7773ddd640720da0e7a69fba29a6552ae736b359d8dd32df31626fc6c3891c93cab978403b1506515feec72de2325a87c93323f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rx-healthcheck (0.1.8)
4
+ rx-healthcheck (0.1.10)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -97,6 +97,19 @@ options: {
97
97
  }
98
98
  ```
99
99
 
100
+ ### Customizing health-check endpoints
101
+
102
+ By default, Rx will mount the health checks at `/liveness`, `/readiness`, and `/deep`. You can customize these endpoints by passing a `liveness_path`, `readiness_path`, and `deep_path` options to the middleware:
103
+
104
+ ```ruby
105
+ # in this example, liveness and readiness endpoints have been customized. the deep
106
+ # endpoint will use the default path (/deep).
107
+ Rx::Middleware.new(options: {
108
+ liveness_path: "/other_liveness",
109
+ readiness_path: "/other_readiness"
110
+ })
111
+ ```
112
+
100
113
  ## Contributing
101
114
 
102
115
  Bug reports and pull requests are welcome on GitHub at https://github.com/zachpendleton/rx.
data/lib/rx/middleware.rb CHANGED
@@ -4,7 +4,10 @@ module Rx
4
4
  class Middleware
5
5
  DEFAULT_OPTIONS = {
6
6
  cache: true,
7
- authorization: nil
7
+ authorization: nil,
8
+ liveness_path: "/liveness",
9
+ readiness_path: "/readiness",
10
+ deep_path: "/deep"
8
11
  }.freeze
9
12
 
10
13
  def initialize(app,
@@ -29,12 +32,12 @@ module Rx
29
32
  end
30
33
 
31
34
  case path(env)
32
- when "/liveness"
35
+ when @options[:liveness_path]
33
36
  ok = check_to_component(liveness_checks).map { |x| x[:status] == 200 }.all?
34
37
  liveness_response(ok)
35
- when "/readiness"
38
+ when @options[:readiness_path]
36
39
  readiness_response(check_to_component(readiness_checks))
37
- when "/deep"
40
+ when @options[:deep_path]
38
41
  if !Rx::Util::HealthCheckAuthorization.new(env, @options[:authorization]).ok?
39
42
  deep_response_authorization_failed
40
43
  else
@@ -68,7 +71,7 @@ module Rx
68
71
  end
69
72
 
70
73
  def health_check_request?(path)
71
- %w[/liveness /readiness /deep].include?(path)
74
+ [@options[:liveness_path], @options[:readiness_path], @options[:deep_path]].include?(path)
72
75
  end
73
76
 
74
77
  def liveness_response(is_ok)
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.9"
4
+ VERSION = "0.1.10"
5
5
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rx-healthcheck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Pendleton
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-27 00:00:00.000000000 Z
11
+ date: 2022-11-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description:
13
+ description:
14
14
  email:
15
15
  - zachpendleton@gmail.com
16
16
  executables: []
@@ -47,7 +47,7 @@ licenses:
47
47
  metadata:
48
48
  homepage_uri: https://github.com/zachpendleton/rx
49
49
  source_code_uri: https://github.com/zachpendleton/rx
50
- post_install_message:
50
+ post_install_message:
51
51
  rdoc_options: []
52
52
  require_paths:
53
53
  - lib
@@ -62,8 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  requirements: []
65
- rubygems_version: 3.1.6
66
- signing_key:
65
+ rubygems_version: 3.3.7
66
+ signing_key:
67
67
  specification_version: 4
68
68
  summary: Standard health checks for Rails and Rack applications
69
69
  test_files: []