Class: Fluence::Gateway::Configuration::TenantConfig

Inherits:
Data
  • Object
show all
Defined in:
lib/fluence/gateway/configuration.rb

Overview

Immutable value object returned by Settings#tenant_config.

Built on top of Data.define, so it is frozen on creation, exposes read-only accessors for every field, and implements hash / eql? / == based on the full tuple of values. This makes it safe to use as a cache key in Fluence::Gateway::Client without any defensive copying at the call site.

ssl_options is deep-duped (via Object#deep_dup from ActiveSupport) and deep-frozen (via IceNine.deep_freeze) at construction time, so neither the top-level Hash nor any nested Hash/Array inside it can be mutated after the TenantConfig is created. nil and non-Hash values are normalised to an empty frozen Hash so the invariant holds even when a tenant override declares ssl_options: nil.

A #[] delegator is kept so code that still reads fields via settings[:client_id] continues to work. Keys must be Symbols — settings['client_id'] raises ArgumentError rather than silently returning nil (as a plain Hash would) or coercing the String to a method name. Unknown Symbol keys raise NoMethodError, matching direct reader access.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#appcenter_urlString (readonly)

The effective appcenter (OAuth2 server) base URL for this tenant.

Returns:

  • (String)

#client_idString? (readonly)

The effective OAuth2 client identifier for this tenant.

Returns:

  • (String, nil)

#client_secretString? (readonly)

The effective OAuth2 client secret for this tenant.

Returns:

  • (String, nil)

#gateway_urlString (readonly)

The effective gateway base URL for this tenant.

Returns:

  • (String)

#scopeString (readonly)

The OAuth2 scope requested on the client_credentials grant.

Returns:

  • (String)

#ssl_ca_fileString? (readonly)

Path to an extra CA file trusted on top of the system store, or nil to use the system store only. Ignored when ssl_verify is :none.

Returns:

  • (String, nil)

#ssl_optionsHash (readonly)

Frozen pass-through Faraday SSL options merged last into the ssl: Hash built for OAuth2::Client#connection_opts.

Returns:

  • (Hash)

#ssl_verifySymbol (readonly)

The canonical SSL verify mode for this tenant (one of :peer, :none, :client_once, :fail_if_no_peer_cert).

Returns:

  • (Symbol)

#ssr_tenantBoolean (readonly)

Whether the effective tenant is a single-service (SSR) tenant. When true, API calls that pass a service: kwarg raise ServiceNotAllowedError.

Returns:

  • (Boolean)

#timeoutInteger (readonly)

The effective HTTP timeout, in seconds, for this tenant.

Returns:

  • (Integer)

Instance Method Details

#[](key) ⇒ Object

Hash-style accessor kept for backward compatibility with callers that used tenant_config(...)[:key] when the method still returned a plain Hash. Symbol-only — passing a String raises ArgumentError rather than silently returning nil (as a plain Hash would for missing keys).

Parameters:

  • key (Symbol)

    the field name

Returns:

  • (Object)

    the value of the field

Raises:

  • (ArgumentError)

    if key is not a Symbol

  • (NoMethodError)

    if key is a Symbol but not a field of TenantConfig