Class: PG::AzureWorkloadIdentity::ConnectionInfo::ActiveRecordConfigurationHash
- Inherits:
-
Object
- Object
- PG::AzureWorkloadIdentity::ConnectionInfo::ActiveRecordConfigurationHash
- Defined in:
- lib/pg/azure_workload_identity/connection_info/active_record_configuration_hash.rb
Overview
Wraps an ActiveRecord database configuration hash (as produced from
config/database.yml) and exposes the connection parameters relevant
to Azure Workload Identity authentication, including the non-standard
azure_workload_identity flag.
Accessor names follow this gem's connection-info contract (user,
host, port) rather than ActiveRecord's keys (note the
:username -> #user mapping).
Instance Method Summary collapse
-
#azure_workload_identity ⇒ Object?
The value of the
azure_workload_identitykey, ornilif not set. -
#host ⇒ String?
The database host.
-
#initialize(configuration_hash) ⇒ ActiveRecordConfigurationHash
constructor
A new instance of ActiveRecordConfigurationHash.
-
#port ⇒ Integer, ...
The database port.
-
#user ⇒ String?
The database username (ActiveRecord's
:usernamekey).
Constructor Details
#initialize(configuration_hash) ⇒ ActiveRecordConfigurationHash
Returns a new instance of ActiveRecordConfigurationHash.
18 19 20 |
# File 'lib/pg/azure_workload_identity/connection_info/active_record_configuration_hash.rb', line 18 def initialize(configuration_hash) @configuration_hash = configuration_hash end |
Instance Method Details
#azure_workload_identity ⇒ Object?
Returns the value of the azure_workload_identity key,
or nil if not set. Truthy values opt the connection into Azure
Workload Identity authentication.
25 26 27 |
# File 'lib/pg/azure_workload_identity/connection_info/active_record_configuration_hash.rb', line 25 def azure_workload_identity @configuration_hash[:azure_workload_identity] end |
#host ⇒ String?
Returns the database host.
36 37 38 |
# File 'lib/pg/azure_workload_identity/connection_info/active_record_configuration_hash.rb', line 36 def host @configuration_hash[:host] end |
#port ⇒ Integer, ...
Returns the database port.
41 42 43 |
# File 'lib/pg/azure_workload_identity/connection_info/active_record_configuration_hash.rb', line 41 def port @configuration_hash[:port] end |
#user ⇒ String?
Returns the database username (ActiveRecord's
:username key).
31 32 33 |
# File 'lib/pg/azure_workload_identity/connection_info/active_record_configuration_hash.rb', line 31 def user @configuration_hash[:username] end |