secvault 1.0.1 → 1.0.3

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: 05e6d8b6e701bdc5bd47c0ab65ea6af571f6476a056fea095bb9ab82085071fe
4
- data.tar.gz: 535caed7383f6c29c605ec8a68df0a0e0210a2d713ba898d03509a9ae68bca95
3
+ metadata.gz: 1feb00404603d98e5aa714c5d3eeeab9821c16922da68196b394166c96180869
4
+ data.tar.gz: 1d1b3c9db92ab5eae322e3803294eb689f81064a8625f16ea2d24d78bbdafc9d
5
5
  SHA512:
6
- metadata.gz: bb4b1cf849d5a319f2b2911c9764cec1383016a409dfcd05258d36e5d1c9d5426e107356962d1a7b2c07c896e7586ae034ec39a70966621894de33c28cd7aa25
7
- data.tar.gz: d71b470eb2682412103c10224d27054ab4c768a8608065b8cd0d86cf3cda2a5c28a73f51097cdb4ff08e6e088e38c5f159e7c6df25893b114fd10f4322319bc3
6
+ metadata.gz: f74172837da3d461a3022574678b79ff322afb0cfa87bab3f5c09ddac4d5eff508fa573b67fe15571122c93ec62611f23405117ec2e33092fe1d61a1ad615ab1
7
+ data.tar.gz: 353b087160697768744a51a1404bf30f2c8b1e7ca22e9d95c833088b003a44fb0e897f03f57dd1df780c193e2f8c81b0a5b41323a23d2ea10730de1599cad817
@@ -48,6 +48,15 @@ module Secvault
48
48
  end
49
49
 
50
50
  # Monkey patch to restore Rails::Secrets interface for backwards compatibility
51
- module Rails
52
- Secrets = Secvault::RailsSecrets
51
+ # Only for Rails 7.2+ where Rails::Secrets was removed
52
+ if defined?(Rails) && Rails.respond_to?(:version)
53
+ rails_version = Rails.version
54
+ major, minor = rails_version.split('.').map(&:to_i)
55
+
56
+ # Only alias for Rails 7.2+ to avoid conflicts with native Rails::Secrets in 7.1
57
+ if major > 7 || (major == 7 && minor >= 2)
58
+ module Rails
59
+ Secrets = Secvault::RailsSecrets
60
+ end
61
+ end
53
62
  end
@@ -12,6 +12,9 @@ module Secvault
12
12
  class Secrets
13
13
  class << self
14
14
  def setup(app)
15
+ # Only auto-setup for Rails 7.2+ where secrets functionality was removed
16
+ return unless rails_7_2_or_later?
17
+
15
18
  secrets_path = app.root.join("config/secrets.yml")
16
19
  key_path = app.root.join("config/secrets.yml.key")
17
20
 
@@ -31,6 +34,19 @@ module Secvault
31
34
  end
32
35
  end
33
36
  end
37
+
38
+ # Manual setup method for Rails 7.1 (opt-in)
39
+ def setup_for_rails_71!(app)
40
+ secrets_path = app.root.join("config/secrets.yml")
41
+ key_path = app.root.join("config/secrets.yml.key")
42
+
43
+ if secrets_path.exist?
44
+ app.config.before_configuration do
45
+ current_env = ENV['RAILS_ENV'] || Rails.env || 'development'
46
+ setup_secrets_immediately(app, secrets_path, key_path, current_env)
47
+ end
48
+ end
49
+ end
34
50
 
35
51
  def setup_secrets_immediately(app, secrets_path, key_path, env)
36
52
  # Set up secrets if they exist
@@ -60,6 +76,8 @@ module Secvault
60
76
  # Parses secrets files and merges shared + environment-specific sections
61
77
  def parse(paths, env:)
62
78
  paths.each_with_object(Hash.new) do |path, all_secrets|
79
+ # Handle string paths by converting to Pathname
80
+ path = Pathname.new(path) unless path.respond_to?(:exist?)
63
81
  next unless path.exist?
64
82
 
65
83
  # Read and process the file content (handle both encrypted and plain)
@@ -147,6 +165,12 @@ module Secvault
147
165
  )
148
166
  encrypted_file.read
149
167
  end
168
+
169
+ def rails_7_2_or_later?
170
+ rails_version = Rails.version
171
+ major, minor = rails_version.split('.').map(&:to_i)
172
+ major > 7 || (major == 7 && minor >= 2)
173
+ end
150
174
  end
151
175
  end
152
176
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Secvault
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.3"
5
5
  end
Binary file
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secvault
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Unnikrishnan KP
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 7.2.0
19
+ version: 7.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 7.2.0
26
+ version: 7.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: zeitwerk
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -40,7 +40,7 @@ dependencies:
40
40
  version: '2.6'
41
41
  description: Secvault restores the classic Rails secrets.yml functionality that was
42
42
  removed in Rails 7.2, allowing you to manage encrypted secrets using the familiar
43
- YAML-based approach. Compatible with Rails 8.0+.
43
+ YAML-based approach. Compatible with Rails 7.1+, 7.2+ and 8.0+.
44
44
  email:
45
45
  - unnikrishnan.kp@bigbinary.com
46
46
  executables: []
@@ -62,6 +62,8 @@ files:
62
62
  - lib/secvault/secrets_helper.rb
63
63
  - lib/secvault/tasks.rake
64
64
  - lib/secvault/version.rb
65
+ - secvault-1.0.1.gem
66
+ - secvault-1.0.2.gem
65
67
  - sig/secvault.rbs
66
68
  homepage: https://github.com/unnitallman/secvault
67
69
  licenses:
@@ -89,5 +91,5 @@ requirements: []
89
91
  rubygems_version: 3.5.10
90
92
  signing_key:
91
93
  specification_version: 4
92
- summary: Rails secrets.yml functionality for Rails 7.2+ and Rails 8.0+
94
+ summary: Rails secrets.yml functionality for Rails 7.1+, 7.2+ and Rails 8.0+
93
95
  test_files: []