pg-aws_rds_iam 0.5.0 → 0.6.1

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: 8de2c77e449ab425d3294a78bfb769377b96e33ef415144066c442103bdca6db
4
+ data.tar.gz: a10dcfe36a489d448cfaaa5a598af4bf99d1f29cb9abc7b0f27fb85de00c08c7
5
5
  SHA512:
6
- metadata.gz: 728e3a062e3dcd036700eacabdbdf7964e46b938f444b71ce58514ae2c0c5f6379cc82821acce7a702b4d25a37ce716dcedd7f44b553b4d24aef4b1811e0b7a4
7
- data.tar.gz: 9b17627b273ae33f07837eb4cd230949ee148f45b9716e74dbe117a1c78c47fc3385461c90192bec2ca0819ba831f2b6a2b69e15ebfb42e290c9f4530af66988
6
+ metadata.gz: e07d05f1b3ba640764c8493e0b27bc94722c8b7afb2688a9168551821dc2518eccc4d74f241a6a91bec51ea67a16e93a72924100014c6643bc7e4c1ddc0fc0aa
7
+ data.tar.gz: 8a3b8388bac508791363b4252283bc48d6b8412c3b99337dad6640ea1475005062bfb1528a82f042b0fd76f46f97afa85d41b221881fee9520f2e4bf2064a9df
data/CHANGELOG.md CHANGED
@@ -8,6 +8,23 @@ 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.1] - 2024-11-12
12
+
13
+ ### Changed
14
+ * Test against Active Record 8.0 ([#685](https://github.com/haines/pg-aws_rds_iam/pull/685))
15
+ * Use `URI::RFC2396_PARSER.regexp[:ABS_URI_REF]` directly to resolve deprecation warning introduced in [ruby/uri#113](https://github.com/ruby/uri/pull/113) ([#685](https://github.com/haines/pg-aws_rds_iam/pull/685))
16
+
17
+ ## [0.6.0] - 2024-10-30
18
+
19
+ ### Changed
20
+ * Require Ruby ≥ 3.1 ([#653](https://github.com/haines/pg-aws_rds_iam/pull/653))
21
+ * Test against Ruby 3.3 ([#589](https://github.com/haines/pg-aws_rds_iam/pull/589))
22
+ * Test against Active Record 7.1 ([#562](https://github.com/haines/pg-aws_rds_iam/pull/562))
23
+ * Test against Active Record 7.2 ([#653](https://github.com/haines/pg-aws_rds_iam/pull/653))
24
+
25
+ ### Fixed
26
+ * Generate auth token for `rails dbconsole` command ([#678](https://github.com/haines/pg-aws_rds_iam/pull/678))
27
+
11
28
  ## [0.5.0] - 2023-05-04
12
29
 
13
30
  ### Changed
@@ -32,8 +49,9 @@ No notable changes.
32
49
  ## [0.4.0] - 2022-06-22
33
50
 
34
51
  ### Changed
35
- * Test against Ruby 3.1 ([#305](https://github.com/haines/pg-aws_rds_iam/pull/305))
36
52
  * Require Ruby ≥ 2.7 and Active Record ≥ 6.0 ([#360](https://github.com/haines/pg-aws_rds_iam/pull/360))
53
+ * Test against Ruby 3.1 ([#305](https://github.com/haines/pg-aws_rds_iam/pull/305))
54
+ * Test against Active Record 7.0 ([#291](https://github.com/haines/pg-aws_rds_iam/pull/291))
37
55
 
38
56
  ### Fixed
39
57
  * Compatibility with `pg` ≥ 1.4 ([#356](https://github.com/haines/pg-aws_rds_iam/pull/356))
@@ -73,7 +91,8 @@ No notable changes.
73
91
  * 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
92
  * ActiveRecord support. ([#3](https://github.com/haines/pg-aws_rds_iam/pull/3))
75
93
 
76
- [Unreleased]: https://github.com/haines/pg-aws_rds_iam/compare/v0.5.0...HEAD
94
+ [Unreleased]: https://github.com/haines/pg-aws_rds_iam/compare/v0.6.0...HEAD
95
+ [0.6.0]: https://github.com/haines/pg-aws_rds_iam/compare/v0.5.0...v0.6.0
77
96
  [0.5.0]: https://github.com/haines/pg-aws_rds_iam/compare/v0.4.2...v0.5.0
78
97
  [0.4.2]: https://github.com/haines/pg-aws_rds_iam/compare/v0.4.1...v0.4.2
79
98
  [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.
@@ -5,7 +5,14 @@ module PG
5
5
  module ConnectionInfo
6
6
  class URI
7
7
  def self.match?(connection_string)
8
- /\A#{::URI::ABS_URI_REF}\z/.match?(connection_string)
8
+ regexp =
9
+ if defined?(::URI::RFC2396_PARSER)
10
+ ::URI::RFC2396_PARSER.regexp[:ABS_URI_REF]
11
+ else
12
+ ::URI::ABS_URI_REF
13
+ end
14
+
15
+ /\A#{regexp}\z/.match?(connection_string)
9
16
  end
10
17
 
11
18
  attr_reader :auth_token_generator_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.1"
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.1
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-11-12 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.1
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.23
94
96
  signing_key:
95
97
  specification_version: 4
96
98
  summary: IAM authentication for PostgreSQL on Amazon RDS