elb-health-check 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/elb-health-check.rb +4 -4
- data/lib/elb_health_check/middleware.rb +8 -9
- data/lib/elb_health_check/railtie.rb +1 -1
- data/lib/elb_health_check/version.rb +3 -1
- metadata +6 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e03ee29bc181a731b7adef0969c7f39d9e2bf5cd926ab0f88d562faa92a9343c
|
4
|
+
data.tar.gz: 7e125d4e4aeed79ea753e6361b80de521e2fcbcce26adff0d3c2de1ae22ad7da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0eba18c2be35baa76e031861fd8b8372d12dc5f935c856452385f0d7110361752fc0df9f6ab58ed6f891999a7b9a66edd26b2640bd94cb941fbb5a4655a002d9
|
7
|
+
data.tar.gz: 3e0ec650fd42a939b0c38e4ca855538427974b6c074f6ecdb4f4986e63138bd581f4b54d17913451eb59061b4c202fa4bba9c35296bf354b2ad0a13e38492894
|
data/lib/elb-health-check.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ElbHealthCheck
|
2
4
|
mattr_accessor :uris, :checks
|
3
5
|
|
@@ -5,11 +7,9 @@ module ElbHealthCheck
|
|
5
7
|
yield self
|
6
8
|
end
|
7
9
|
|
8
|
-
|
9
|
-
self.
|
10
|
-
self.checks = %i(database)
|
10
|
+
self.uris = ['/health-check', '/healthcheck', '/health_check']
|
11
|
+
self.checks = %i[database]
|
11
12
|
end
|
12
13
|
|
13
14
|
require 'elb_health_check/middleware'
|
14
15
|
require 'elb_health_check/railtie'
|
15
|
-
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ElbHealthCheck
|
2
4
|
class Middleware
|
3
5
|
attr_accessor :app
|
@@ -7,18 +9,15 @@ module ElbHealthCheck
|
|
7
9
|
end
|
8
10
|
|
9
11
|
def call(env)
|
10
|
-
|
12
|
+
return app.call(env) unless ElbHealthCheck.uris.include?(env['PATH_INFO'])
|
11
13
|
|
12
|
-
|
14
|
+
checks = ElbHealthCheck.checks.map { |check| send("#{check}?") }
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
16
|
+
if checks.include?(false)
|
17
|
+
[500, {}, ['FAILED']]
|
18
|
+
else
|
19
|
+
[200, {}, ['OK']]
|
19
20
|
end
|
20
|
-
|
21
|
-
app.call(env)
|
22
21
|
end
|
23
22
|
|
24
23
|
private
|
metadata
CHANGED
@@ -1,37 +1,23 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elb-health-check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joergen Dahlke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '3.0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '3.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
14
|
+
name: railties
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
19
|
version: '0'
|
34
|
-
type: :
|
20
|
+
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
@@ -39,7 +25,7 @@ dependencies:
|
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
28
|
+
name: rubocop
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
31
|
- - ">="
|
@@ -82,8 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
68
|
- !ruby/object:Gem::Version
|
83
69
|
version: '0'
|
84
70
|
requirements: []
|
85
|
-
|
86
|
-
rubygems_version: 2.5.2
|
71
|
+
rubygems_version: 3.0.3.1
|
87
72
|
signing_key:
|
88
73
|
specification_version: 4
|
89
74
|
summary: Simple healthcheck for Rails apps
|