Module: PG::AzureWorkloadIdentity::ActiveRecordPostgreSQLDatabaseTasks

Defined in:
lib/pg/azure_workload_identity/active_record_postgresql_database_tasks.rb

Overview

Patch prepended to ActiveRecord::Tasks::PostgreSQLDatabaseTasks that wires Azure Workload Identity authentication into rake tasks that shell out to psql (e.g. db:structure:load, db:structure:dump).

ActiveRecord builds an environment hash for the psql subprocess via the private #psql_env method; this override generates an auth token and adds it to that hash as PGPASSWORD whenever the configuration opts into workload identity, so the psql invocation authenticates without prompting.