Class: FirebaseHostingClientIp::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/firebase_hosting_client_ip/configuration.rb,
sig/firebase_hosting_client_ip.rbs

Overview

Holds the gem's single configuration option.

missing_header_fallback controls what request.remote_ip returns when the Fastly-Client-IP header is absent or invalid:

:passthrough (default) - leave Rails' own value untouched. Behind
Firebase Hosting -> Cloud Run this is typically a Google front-end
address, not the client.
any String - written to request.remote_ip as-is, so the application can
recognize "client IP unknown" and act on it (e.g. fail closed). The
gem imposes no semantics on the sentinel; any String is accepted,
including "". It must be a String because Request#remote_ip is
`(get_header("action_dispatch.remote_ip") || ip).to_s` - a nil or
false env value silently falls through to Rack's calculation.

Constant Summary collapse

PASSTHROUGH =

Returns:

:passthrough

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



23
24
25
# File 'lib/firebase_hosting_client_ip/configuration.rb', line 23

def initialize
  @missing_header_fallback = PASSTHROUGH
end

Instance Attribute Details

#missing_header_fallback:passthrough, String

Returns the value of attribute missing_header_fallback.

Returns:



21
22
23
# File 'lib/firebase_hosting_client_ip/configuration.rb', line 21

def missing_header_fallback
  @missing_header_fallback
end