health-monitor-rails 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/app/controllers/health_monitor/health_controller.rb +15 -1
- data/lib/health_monitor/configuration.rb +1 -1
- data/lib/health_monitor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d9ca6fb1d552400da00021ab3c8bfb66f311b25
|
4
|
+
data.tar.gz: 862544d6a13134de1ca23edc2ebe203efb024e2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc601bd99b8a8ace298a6a73c0a59c4a60b894078a52ed353246c3b94b72ea9d399c7b2916806ee7e9b23dd9fa814429764b964419fb6465e203be4d76cd1dde
|
7
|
+
data.tar.gz: b7e8d9dbd8b2fa01fdd5826b09d8ff895954e87aa89364650c8d5798f6b7f851b401f827f2796d49390565402132b6fd0c55e990d9196c547214739a7d16b3c3
|
data/README.md
CHANGED
@@ -75,6 +75,18 @@ HealthMonitor.configure do |config|
|
|
75
75
|
end
|
76
76
|
```
|
77
77
|
|
78
|
+
### Adding authentication credentials
|
79
|
+
By default, the `/check` endpoint is not authenticated and is available to any user. You can authenticate using HTTP Basic Auth by providing authentication credentials:
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
HealthMonitor.configure do |config|
|
83
|
+
config.basic_auth_credentials = {
|
84
|
+
username: 'SECRET_NAME',
|
85
|
+
password: 'Shhhhh!!!'
|
86
|
+
}
|
87
|
+
end
|
88
|
+
```
|
89
|
+
|
78
90
|
## License
|
79
91
|
|
80
92
|
The MIT License (MIT)
|
@@ -1,6 +1,11 @@
|
|
1
1
|
module HealthMonitor
|
2
2
|
class HealthController < ActionController::Metal
|
3
|
-
|
3
|
+
include AbstractController::Callbacks
|
4
|
+
include ActionController::HttpAuthentication::Basic::ControllerMethods
|
5
|
+
|
6
|
+
before_action :authenticate_with_basic_auth
|
7
|
+
|
8
|
+
# GET /health/check
|
4
9
|
def check
|
5
10
|
HealthMonitor.check!
|
6
11
|
|
@@ -19,5 +24,14 @@ module HealthMonitor
|
|
19
24
|
end
|
20
25
|
|
21
26
|
alias_method_chain :process, :silence
|
27
|
+
|
28
|
+
def authenticate_with_basic_auth
|
29
|
+
return true unless HealthMonitor.configuration.basic_auth_credentials
|
30
|
+
|
31
|
+
credentials = HealthMonitor.configuration.basic_auth_credentials
|
32
|
+
authenticate_or_request_with_http_basic do |name, password|
|
33
|
+
name == credentials[:username] && password == credentials[:password]
|
34
|
+
end
|
35
|
+
end
|
22
36
|
end
|
23
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: health-monitor-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonid Beder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|