activerecord-cipherstash-pg-adapter 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 +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/active_record/connection_adapters/6.1/postgres_cipherstash_adapter.rb +1 -1
- data/lib/active_record/connection_adapters/7.0/postgres_cipherstash_adapter.rb +1 -1
- data/lib/active_record/connection_adapters/cipherstash_pg/railtie.rb +40 -0
- data/lib/active_record/connection_adapters/postgres_cipherstash_adapter.rb +3 -4
- data/lib/activerecord-cipherstash-pg-adapter.rb +1 -16
- data/lib/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b22c3a2c87a993eaf0833dd013954e25925e6675cec8ff40798ad4ee932db0e
|
4
|
+
data.tar.gz: fc7ed2b4e78b808d1e0618a4d2db0897dd053ff022115037f46035bbd2afa8e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 077cb9e80c55e8ec7f8677e273cdab265ac32eae95270cdbed7f6805591f793bb7482d51b288029dc8365b5f52d58405f7c69606464351ef3d014e582bbd6c18
|
7
|
+
data.tar.gz: c4da8c6e9f12e0fa96c4a5c32a78bdc3f3028d27e189062971c5db4e0730bbe823690cd4ed80f332c5f335bd5294003e43d4e054f29ba38d5d3ce4db2dc147e6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.6.1] - 2023-04-26
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
|
7
|
+
- Removed Rails as a hard dependency
|
8
|
+
|
9
|
+
## [0.6.0] - 2023-04-20
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
- Updated the adapter name constant to be the same as the ActiveRecord PostgreSQL adapter.
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
|
17
|
+
- Logic around Rails credentials taking precedence over local env vars.
|
18
|
+
|
3
19
|
## [0.5.0] - 2023-04-19
|
4
20
|
|
5
21
|
### Added
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module ConnectionAdapters
|
5
|
+
module CipherStashPG
|
6
|
+
class Railtie < ::Rails::Railtie
|
7
|
+
rake_tasks do
|
8
|
+
load "cipherstash_tasks.rake"
|
9
|
+
end
|
10
|
+
|
11
|
+
initializer "postgres_cipherstash_adapter.configure" do
|
12
|
+
if defined?(Rails.application.credentials)
|
13
|
+
cs_credentials = Rails.application.credentials.try(:cipherstash)
|
14
|
+
|
15
|
+
client_id = cs_credentials&.fetch(:client_id, nil)
|
16
|
+
client_key = cs_credentials&.fetch(:client_key, nil)
|
17
|
+
workspace_id = cs_credentials&.fetch(:workspace_id, nil)
|
18
|
+
client_access_key = cs_credentials&.fetch(:client_access_key, nil)
|
19
|
+
|
20
|
+
unless client_id.nil?
|
21
|
+
ENV["CS_CLIENT_ID"] = client_id
|
22
|
+
end
|
23
|
+
|
24
|
+
unless client_key.nil?
|
25
|
+
ENV["CS_CLIENT_KEY"] = client_key
|
26
|
+
end
|
27
|
+
|
28
|
+
unless workspace_id.nil?
|
29
|
+
ENV["CS_WORKSPACE_ID"] = workspace_id
|
30
|
+
end
|
31
|
+
|
32
|
+
unless client_access_key.nil?
|
33
|
+
ENV["CS_CLIENT_ACCESS_KEY"] = client_access_key
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
3
|
# Why the funky filename
|
4
|
-
# (lib/active_record/connection_adapters/
|
4
|
+
# (lib/active_record/connection_adapters/postgres_cipherstash_adapter.rb)
|
5
5
|
# that doesn't match the gem structure? It's to hook into Rails.
|
6
6
|
#
|
7
7
|
# See this chunk from:
|
@@ -31,13 +31,12 @@
|
|
31
31
|
|
32
32
|
require "cipherstash-pg"
|
33
33
|
|
34
|
-
case
|
34
|
+
case ActiveRecord::VERSION::MAJOR
|
35
35
|
when 7
|
36
36
|
require "active_record/connection_adapters/7.0/postgres_cipherstash_adapter"
|
37
37
|
when 6
|
38
38
|
require "active_record/connection_adapters/6.1/postgres_cipherstash_adapter"
|
39
39
|
else
|
40
|
-
STDERR.puts "CipherStash only supports
|
40
|
+
STDERR.puts "CipherStash only supports ActiveRecord versions 6.x and 7.x"
|
41
41
|
exit 1
|
42
42
|
end
|
43
|
-
|
@@ -3,26 +3,11 @@ require "active_record"
|
|
3
3
|
|
4
4
|
require "active_record/connection_adapters/cipherstash_pg/database_extensions"
|
5
5
|
require "active_record/connection_adapters/cipherstash_pg/database_tasks"
|
6
|
+
require "active_record/connection_adapters/cipherstash_pg/railtie" if defined?(Rails::Railtie)
|
6
7
|
|
7
8
|
module ActiveRecord
|
8
9
|
module ConnectionAdapters
|
9
10
|
module CipherStashPG
|
10
|
-
class Railtie < ::Rails::Railtie
|
11
|
-
rake_tasks do
|
12
|
-
load "cipherstash_tasks.rake"
|
13
|
-
end
|
14
|
-
|
15
|
-
initializer "postgres_cipherstash_adapter.configure" do
|
16
|
-
if defined?(Rails.application.credentials)
|
17
|
-
cs_credentials = Rails.application.credentials.try(:cipherstash)
|
18
|
-
ENV["CS_CLIENT_ID"] = cs_credentials&.fetch(:client_id, nil)
|
19
|
-
ENV["CS_CLIENT_KEY"] = cs_credentials&.fetch(:client_key, nil)
|
20
|
-
ENV["CS_WORKSPACE_ID"] = cs_credentials&.fetch(:workspace_id, nil)
|
21
|
-
ENV["CS_CLIENT_ACCESS_KEY"] = cs_credentials&.fetch(:client_access_key, nil)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
11
|
# Method to install CipherStash custom ORE types
|
27
12
|
def self.install
|
28
13
|
CipherStashPG::DatabaseExtensions.install
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-cipherstash-pg-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robin Howard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -138,6 +138,7 @@ files:
|
|
138
138
|
- lib/active_record/connection_adapters/cipherstash_column_mapper.rb
|
139
139
|
- lib/active_record/connection_adapters/cipherstash_pg/database_extensions.rb
|
140
140
|
- lib/active_record/connection_adapters/cipherstash_pg/database_tasks.rb
|
141
|
+
- lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
|
141
142
|
- lib/active_record/connection_adapters/postgres_cipherstash_adapter.rb
|
142
143
|
- lib/activerecord-cipherstash-pg-adapter.rb
|
143
144
|
- lib/cipherstash_tasks.rake
|