rails-healthcheck 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/healthcheck/healthchecks_controller.rb +14 -22
- data/lib/healthcheck/checker.rb +4 -1
- data/lib/healthcheck/version.rb +1 -1
- data/lib/healthcheck.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc601f25aec17caeb2d47054f8ded7aebae50eca08dc0e3261990ea71f14d1b9
|
4
|
+
data.tar.gz: c52256a6152ecbf4b35a3d10678d471f1b39310f6db9c7738f5d08f7c687528a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f6f1011049080ff2cceba13fb37fd7ced41a8f455abcd30b84591972e448a9c69cd934768efbea731261273367c605ae23895cbb2135f4e4cab7a2042eab300
|
7
|
+
data.tar.gz: 6537e333c8c8b53153dbd23639ad32ed2dd088292ba70590de4b845dbcdf7013cad1a106cdb09c16e01f22bda4a3d529ce2f29c63b10b62e20b485c44fcd5ca9
|
@@ -4,36 +4,28 @@ require 'action_controller/railtie'
|
|
4
4
|
module Healthcheck
|
5
5
|
class HealthchecksController < ActionController::Base
|
6
6
|
def check
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
7
|
+
checker = Healthcheck.check
|
8
|
+
return head Healthcheck.configuration.success unless checker.errored?
|
12
9
|
|
13
|
-
|
14
|
-
checker.check
|
10
|
+
verbose? ? verbose_error(checker) : head_error
|
15
11
|
end
|
16
12
|
|
17
|
-
|
18
|
-
checker.errored?
|
19
|
-
end
|
13
|
+
private
|
20
14
|
|
21
|
-
def
|
22
|
-
|
15
|
+
def head_error
|
16
|
+
head(Healthcheck.configuration.error)
|
23
17
|
end
|
24
18
|
|
25
|
-
def
|
26
|
-
|
19
|
+
def verbose_error(checker)
|
20
|
+
render status: Healthcheck.configuration.error,
|
21
|
+
json: {
|
22
|
+
code: Healthcheck.configuration.error,
|
23
|
+
errors: checker.errors.as_json
|
24
|
+
}
|
27
25
|
end
|
28
26
|
|
29
|
-
def
|
30
|
-
|
31
|
-
|
32
|
-
render json: {
|
33
|
-
code: Healthcheck.configuration.error,
|
34
|
-
errors: checker.errors.as_json
|
35
|
-
},
|
36
|
-
status: Healthcheck.configuration.error
|
27
|
+
def verbose?
|
28
|
+
Healthcheck.configuration.verbose
|
37
29
|
end
|
38
30
|
end
|
39
31
|
end
|
data/lib/healthcheck/checker.rb
CHANGED
data/lib/healthcheck/version.rb
CHANGED
data/lib/healthcheck.rb
CHANGED