pg-aws_rds_iam 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- 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/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: 94635722d8000b0961d12c63c2860cc45cf980f501dd98fd2e19873a7109b0a0
|
4
|
+
data.tar.gz: abc349b32a7318ae752d3d07e4fb51cd6c06b9c07e5863a8ca5d87c0906b6489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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:
|
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.
|
@@ -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.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:
|
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.
|
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.
|
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.22
|
94
96
|
signing_key:
|
95
97
|
specification_version: 4
|
96
98
|
summary: IAM authentication for PostgreSQL on Amazon RDS
|