activerecord-cipherstash-pg-adapter 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a76ecda67534aee78fe658b78c5ba3f7834f59c229b7391d75fd736d7aa4e23
4
- data.tar.gz: 13284339b37ab578d8ce181a9c291bb4826f556caedbac55f9cc2b9cb1fb3084
3
+ metadata.gz: 3b22c3a2c87a993eaf0833dd013954e25925e6675cec8ff40798ad4ee932db0e
4
+ data.tar.gz: fc7ed2b4e78b808d1e0618a4d2db0897dd053ff022115037f46035bbd2afa8e4
5
5
  SHA512:
6
- metadata.gz: 9644a5705b513fa4356f193995fc5b462acac8d66fba7c02031a51e3a0ad2e864865d84f561ea70ec0582129815a38920b3e557c1a29753597c86f0346c6d5df
7
- data.tar.gz: cc240e5e9b255e4075cfc9ea13c40cf9b5715b8cd1b4a82f4dff8b98ae9112999413afaff9a10984947a2629d334868d95888e36b5ff3ea29fb82d5f29344ee4
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
@@ -53,7 +53,7 @@ module ActiveRecord
53
53
 
54
54
  module ConnectionAdapters
55
55
  class CipherStashPGAdapter < AbstractAdapter
56
- ADAPTER_NAME = "CipherStash PostgreSQL"
56
+ ADAPTER_NAME = "PostgreSQL"
57
57
 
58
58
  class << self
59
59
  def new_client(conn_params)
@@ -54,7 +54,7 @@ module ActiveRecord
54
54
 
55
55
  module ConnectionAdapters
56
56
  class CipherStashPGAdapter < AbstractAdapter
57
- ADAPTER_NAME = "CipherStash PostgreSQL"
57
+ ADAPTER_NAME = "PostgreSQL"
58
58
 
59
59
  class << self
60
60
  def new_client(conn_params)
@@ -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/cipherstash_pg_adapter.rb)
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 Rails::VERSION::MAJOR
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 Rails versions 6.x and 7.x"
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
@@ -1,3 +1,3 @@
1
1
  module ActiveRecord
2
- CIPHERSTASH_PG_ADAPTER_VERSION = "0.5.0"
2
+ CIPHERSTASH_PG_ADAPTER_VERSION = "0.6.1"
3
3
  end
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.5.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-19 00:00:00.000000000 Z
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