Module: PG::AzureWorkloadIdentity::ActiveRecordPostgreSQLAdapter
- Included in:
- PG::AzureWorkloadIdentity
- Defined in:
- lib/pg/azure_workload_identity/active_record_postgresql_adapter.rb
Overview
Patch prepended to
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.singleton_class
that wires Azure Workload Identity authentication into the
rails dbconsole / rails db flow.
The adapter's dbconsole class method is responsible for launching
psql against the configured database; without this patch, psql
would prompt for (or fail without) a password when the configuration
opts into workload identity. The override generates an auth token and
exposes it via PGPASSWORD before delegating to the original
implementation.
Instance Method Summary collapse
-
#dbconsole(config, options = {}) ⇒ void
Sets
PGPASSWORDon the environment to a freshly generated Azure Workload Identity auth token when the configuration enables it, then delegates to the originaldbconsoleimplementation.
Instance Method Details
#dbconsole(config, options = {}) ⇒ void
This method returns an undefined value.
Sets PGPASSWORD on the environment to a freshly generated Azure
Workload Identity auth token when the configuration enables it, then
delegates to the original dbconsole implementation.
27 28 29 30 |
# File 'lib/pg/azure_workload_identity/active_record_postgresql_adapter.rb', line 27 def dbconsole(config, = {}) AuthTokenInjector.new.inject_into_psql_env! config.configuration_hash, ENV super end |