pg-aws_rds_iam 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c9ccecc905798c9f5490496c9f035b4e2acf2f2f7bec49a055a131d833d2d90
4
- data.tar.gz: effef9f8dde649d102ba9ee95a76937f57b5b1c802e09ebaf8b9189c6d2591c0
3
+ metadata.gz: 94635722d8000b0961d12c63c2860cc45cf980f501dd98fd2e19873a7109b0a0
4
+ data.tar.gz: abc349b32a7318ae752d3d07e4fb51cd6c06b9c07e5863a8ca5d87c0906b6489
5
5
  SHA512:
6
- metadata.gz: 728e3a062e3dcd036700eacabdbdf7964e46b938f444b71ce58514ae2c0c5f6379cc82821acce7a702b4d25a37ce716dcedd7f44b553b4d24aef4b1811e0b7a4
7
- data.tar.gz: 9b17627b273ae33f07837eb4cd230949ee148f45b9716e74dbe117a1c78c47fc3385461c90192bec2ca0819ba831f2b6a2b69e15ebfb42e290c9f4530af66988
6
+ metadata.gz: e3049603b1e2b604d099befce44ea754a14724581e33841067d00461d51ef07a19c2276e9d88a386bba886f0ae89d93287a23c100535160f8ab4a0753d2377a7
7
+ data.tar.gz: 6fe8c3dcc525fb048bb652b9db21e9fb2855bed0a527965a2c2ffb42c36e652586668af37c92ef4dbd9900e9a8f1bfaea64d99d1aeebdadcf60f886dd90ab658
data/CHANGELOG.md CHANGED
@@ -8,6 +8,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8
8
 
9
9
  No notable changes.
10
10
 
11
+ ## [0.6.0] - 2024-10-30
12
+
13
+ ### Changed
14
+ * Require Ruby ≥ 3.1 ([#653](https://github.com/haines/pg-aws_rds_iam/pull/653))
15
+
16
+ ### Fixed
17
+ * Generate auth token for `rails dbconsole` command ([#678](https://github.com/haines/pg-aws_rds_iam/pull/678))
18
+
11
19
  ## [0.5.0] - 2023-05-04
12
20
 
13
21
  ### Changed
@@ -73,7 +81,8 @@ No notable changes.
73
81
  * A plugin for the [`pg` gem](https://rubygems.org/gems/pg) that adds support for [IAM authentication](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html) when connecting to PostgreSQL databases hosted in Amazon RDS. ([#1](https://github.com/haines/pg-aws_rds_iam/pull/1))
74
82
  * ActiveRecord support. ([#3](https://github.com/haines/pg-aws_rds_iam/pull/3))
75
83
 
76
- [Unreleased]: https://github.com/haines/pg-aws_rds_iam/compare/v0.5.0...HEAD
84
+ [Unreleased]: https://github.com/haines/pg-aws_rds_iam/compare/v0.6.0...HEAD
85
+ [0.6.0]: https://github.com/haines/pg-aws_rds_iam/compare/v0.5.0...v0.6.0
77
86
  [0.5.0]: https://github.com/haines/pg-aws_rds_iam/compare/v0.4.2...v0.5.0
78
87
  [0.4.2]: https://github.com/haines/pg-aws_rds_iam/compare/v0.4.1...v0.4.2
79
88
  [0.4.1]: https://github.com/haines/pg-aws_rds_iam/compare/v0.4.0...v0.4.1
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PG
4
+ module AWS_RDS_IAM
5
+ module ActiveRecordPostgreSQLAdapter
6
+ def dbconsole(config, *)
7
+ AuthTokenInjector.new.inject_into_psql_env! config.configuration_hash, ENV
8
+ super
9
+ end
10
+ end
11
+
12
+ private_constant :ActiveRecordPostgreSQLAdapter
13
+ end
14
+ end
@@ -11,7 +11,7 @@ module PG
11
11
  # @param credentials [Aws::CredentialProvider] the IAM credentials with which to sign the token
12
12
  # @param region [String] the AWS region in which the RDS instances are running
13
13
  def initialize(credentials:, region:)
14
- @generator = Aws::RDS::AuthTokenGenerator.new(credentials: credentials)
14
+ @generator = Aws::RDS::AuthTokenGenerator.new(credentials:)
15
15
  @region = region
16
16
  end
17
17
 
@@ -18,8 +18,8 @@ module PG
18
18
  # @param name [String, Symbol]
19
19
  # @return [void]
20
20
  # @yieldreturn [AuthTokenGenerator]
21
- def add(name, &block)
22
- @registry[name.to_s] = Memoizer.new(&block)
21
+ def add(name, &)
22
+ @registry[name.to_s] = Memoizer.new(&)
23
23
  end
24
24
 
25
25
  # Looks up an {AuthTokenGenerator} by name.
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PG
4
+ module AWS_RDS_IAM
5
+ module RailsDBConsole
6
+ private
7
+
8
+ def find_cmd_and_exec(*)
9
+ AuthTokenInjector.new.inject_into_psql_env! db_config.configuration_hash, ENV
10
+ super
11
+ end
12
+ end
13
+
14
+ private_constant :RailsDBConsole
15
+ end
16
+ end
@@ -3,6 +3,6 @@
3
3
  module PG
4
4
  module AWS_RDS_IAM
5
5
  # The current version of the gem.
6
- VERSION = "0.5.0"
6
+ VERSION = "0.6.0"
7
7
  end
8
8
  end
@@ -28,9 +28,23 @@ module PG
28
28
  PG::Connection.singleton_class.prepend Connection
29
29
 
30
30
  if defined?(ActiveRecord)
31
+ require "active_record/connection_adapters/postgresql_adapter"
32
+
33
+ if ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.respond_to?(:dbconsole)
34
+ require_relative "aws_rds_iam/active_record_postgresql_adapter"
35
+
36
+ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.singleton_class.prepend ActiveRecordPostgreSQLAdapter
37
+ end
38
+
31
39
  require_relative "aws_rds_iam/active_record_postgresql_database_tasks"
32
40
 
33
41
  ActiveRecord::Tasks::PostgreSQLDatabaseTasks.prepend ActiveRecordPostgreSQLDatabaseTasks
34
42
  end
43
+
44
+ if defined?(Rails::DBConsole) && Rails::DBConsole.private_instance_methods.include?(:find_cmd_and_exec)
45
+ require_relative "aws_rds_iam/rails_dbconsole"
46
+
47
+ Rails::DBConsole.prepend RailsDBConsole
48
+ end
35
49
  end
36
50
  end
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
34
34
 
35
35
  spec.require_paths = ["lib"]
36
36
 
37
- spec.required_ruby_version = ">= 3.0"
37
+ spec.required_ruby_version = ">= 3.1"
38
38
 
39
39
  spec.add_dependency "aws-sdk-rds", "~> 1.0"
40
40
  spec.add_dependency "pg", "~> 1.1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg-aws_rds_iam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Haines
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-04 00:00:00.000000000 Z
11
+ date: 2024-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-rds
@@ -51,6 +51,7 @@ files:
51
51
  - LICENSE.txt
52
52
  - README.md
53
53
  - lib/pg/aws_rds_iam.rb
54
+ - lib/pg/aws_rds_iam/active_record_postgresql_adapter.rb
54
55
  - lib/pg/aws_rds_iam/active_record_postgresql_database_tasks.rb
55
56
  - lib/pg/aws_rds_iam/active_record_postgresql_database_tasks/psql_env.rb
56
57
  - lib/pg/aws_rds_iam/active_record_postgresql_database_tasks/set_psql_env.rb
@@ -63,6 +64,7 @@ files:
63
64
  - lib/pg/aws_rds_iam/connection_info/keyword_value_string.rb
64
65
  - lib/pg/aws_rds_iam/connection_info/parse_error.rb
65
66
  - lib/pg/aws_rds_iam/connection_info/uri.rb
67
+ - lib/pg/aws_rds_iam/rails_dbconsole.rb
66
68
  - lib/pg/aws_rds_iam/version.rb
67
69
  - pg-aws_rds_iam.gemspec
68
70
  homepage: https://github.com/haines/pg-aws_rds_iam
@@ -71,7 +73,7 @@ licenses:
71
73
  metadata:
72
74
  bug_tracker_uri: https://github.com/haines/pg-aws_rds_iam/issues
73
75
  changelog_uri: https://github.com/haines/pg-aws_rds_iam/blob/main/CHANGELOG.md
74
- documentation_uri: https://rubydoc.info/gems/pg-aws_rds_iam/0.5.0
76
+ documentation_uri: https://rubydoc.info/gems/pg-aws_rds_iam/0.6.0
75
77
  homepage_uri: https://github.com/haines/pg-aws_rds_iam
76
78
  source_code_uri: https://github.com/haines/pg-aws_rds_iam
77
79
  rubygems_mfa_required: 'true'
@@ -83,14 +85,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
85
  requirements:
84
86
  - - ">="
85
87
  - !ruby/object:Gem::Version
86
- version: '3.0'
88
+ version: '3.1'
87
89
  required_rubygems_version: !ruby/object:Gem::Requirement
88
90
  requirements:
89
91
  - - ">="
90
92
  - !ruby/object:Gem::Version
91
93
  version: '0'
92
94
  requirements: []
93
- rubygems_version: 3.4.12
95
+ rubygems_version: 3.5.22
94
96
  signing_key:
95
97
  specification_version: 4
96
98
  summary: IAM authentication for PostgreSQL on Amazon RDS