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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +13 -0
- data/lib/rx/middleware.rb +8 -5
- data/lib/rx/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 825528f73f53ce6f4a0da5495543859293ee6688e23cf1b1365206738e02e420
|
4
|
+
data.tar.gz: 2b447c79ac8bed5bf4e3ee84fc19e1eda62575368d714b5eb4ea472fcb59ed77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b10aa92da2efb24e41afc29637df1160c73e6af556be2a3db64d69949b8163c84a5a7b05c3050b52e2189231140669fdb94113554196cd7d2eaa5fa628e997f1
|
7
|
+
data.tar.gz: fa7b6088065d80115b39b844e7773ddd640720da0e7a69fba29a6552ae736b359d8dd32df31626fc6c3891c93cab978403b1506515feec72de2325a87c93323f
|
data/Gemfile.lock
CHANGED
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
|
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
|
38
|
+
when @options[:readiness_path]
|
36
39
|
readiness_response(check_to_component(readiness_checks))
|
37
|
-
when
|
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
|
-
|
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
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.
|
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-
|
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.
|
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: []
|