health_monitor_lb 1.2.1 → 1.3.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33a8a365928de710968a78865c71c6be2dd2157c47fd1017f931cbabcb2d8f8d
|
4
|
+
data.tar.gz: e17937a0336bb1bd79f29f90f6f88461046e2d1f9730830c4654cfd08912d3eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a63c5da1569c815d301a7b4d9033c2a4a92ffa751a6b4cdf16fbe77f70932725330cda76151b8ac110110f6c5613dc4b7f8da7baf1635497743e7fffcdcbd3f
|
7
|
+
data.tar.gz: 476956f78d397b1625805be5a1f0cf68838de3a559559d5bbcb423d84d9cdaf47515a8d64a1166df11079e82e8da84a37938f1e65ed294c805f45c27c0d53154
|
@@ -3,6 +3,12 @@ module HealthMonitorLb
|
|
3
3
|
before_action :check_api_token
|
4
4
|
|
5
5
|
def check_api_token
|
6
|
+
class << request
|
7
|
+
def port
|
8
|
+
80
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
6
12
|
if ENV['HEALTH_MONITOR_API_TOKEN'].present? && (params['API_TOKEN'] != ENV['HEALTH_MONITOR_API_TOKEN'])
|
7
13
|
render json: 'unauthorized', status: :unauthorized
|
8
14
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module HealthMonitorLb
|
2
2
|
class HealthController < ApplicationController
|
3
|
-
before_action :disable_ssl, only: :disable_ssl_actions
|
4
|
-
|
5
3
|
def index
|
6
4
|
status = HealthCheckService.new.call
|
7
5
|
|
@@ -11,17 +9,5 @@ module HealthMonitorLb
|
|
11
9
|
|
12
10
|
render json: status, status: :ok
|
13
11
|
end
|
14
|
-
|
15
|
-
def disable_ssl
|
16
|
-
# This is a workaround for the issue with SSL termination in AWS ELB
|
17
|
-
# where the health check URL is not accessible over HTTP.
|
18
|
-
redirect_to request.url.gsub(/https/i, 'http') if request.ssl?
|
19
|
-
end
|
20
|
-
|
21
|
-
def disable_ssl_actions
|
22
|
-
actions = []
|
23
|
-
actions << :index unless ENV['ENABLE_HEALTH_CHECK_SSL']
|
24
|
-
actions
|
25
|
-
end
|
26
12
|
end
|
27
13
|
end
|
data/spec/dummy/log/test.log
CHANGED
@@ -209,3 +209,12 @@ Completed 200 OK in 112ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 385
|
|
209
209
|
Processing by HealthMonitorLb::HealthController#index as HTML
|
210
210
|
Parameters: {"API_TOKEN"=>"[FILTERED]"}
|
211
211
|
Completed 200 OK in 106ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 185)
|
212
|
+
Processing by HealthMonitorLb::HealthController#index as HTML
|
213
|
+
Filter chain halted as :check_api_token rendered or redirected
|
214
|
+
Completed 401 Unauthorized in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 295)
|
215
|
+
Processing by HealthMonitorLb::HealthController#index as HTML
|
216
|
+
Parameters: {"API_TOKEN"=>"[FILTERED]"}
|
217
|
+
Completed 200 OK in 117ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 402)
|
218
|
+
Processing by HealthMonitorLb::HealthController#index as HTML
|
219
|
+
Parameters: {"API_TOKEN"=>"[FILTERED]"}
|
220
|
+
Completed 200 OK in 102ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 202)
|