Class: Rx::Util::HealthCheckAuthorization
- Inherits:
-
Object
- Object
- Rx::Util::HealthCheckAuthorization
- Defined in:
- lib/rx/util/health_check_authorization.rb
Constant Summary collapse
- HTTP_HEADER =
"HTTP_AUTHORIZATION"
Instance Method Summary collapse
-
#initialize(env, authorization) ⇒ HealthCheckAuthorization
constructor
A new instance of HealthCheckAuthorization.
- #ok? ⇒ Boolean
Constructor Details
#initialize(env, authorization) ⇒ HealthCheckAuthorization
Returns a new instance of HealthCheckAuthorization.
6 7 8 9 |
# File 'lib/rx/util/health_check_authorization.rb', line 6 def initialize(env, ) @authorization = @env = env end |
Instance Method Details
#ok? ⇒ Boolean
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rx/util/health_check_authorization.rb', line 11 def ok? case @authorization when NilClass true when Proc @authorization.call(@env) when String @authorization == @env[HTTP_HEADER] else raise StandardError.new("Authorization is not configured properly") end end |