pg-aws_rds_iam 0.5.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -2
- data/lib/pg/aws_rds_iam/active_record_postgresql_adapter.rb +14 -0
- data/lib/pg/aws_rds_iam/auth_token_generator.rb +1 -1
- data/lib/pg/aws_rds_iam/auth_token_generator_registry.rb +2 -2
- data/lib/pg/aws_rds_iam/connection_info/uri.rb +8 -1
- data/lib/pg/aws_rds_iam/rails_dbconsole.rb +16 -0
- data/lib/pg/aws_rds_iam/version.rb +1 -1
- data/lib/pg/aws_rds_iam.rb +14 -0
- data/pg-aws_rds_iam.gemspec +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8de2c77e449ab425d3294a78bfb769377b96e33ef415144066c442103bdca6db
|
4
|
+
data.tar.gz: a10dcfe36a489d448cfaaa5a598af4bf99d1f29cb9abc7b0f27fb85de00c08c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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:
|
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, &
|
22
|
-
@registry[name.to_s] = Memoizer.new(&
|
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
|
-
|
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
|
data/lib/pg/aws_rds_iam.rb
CHANGED
@@ -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
|
data/pg-aws_rds_iam.gemspec
CHANGED
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.
|
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:
|
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.
|
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.
|
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.
|
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
|