secvault 1.0.2 → 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: 4b3a4f3dd5a26567e78f90b281928f6cac684dc2f2a174bba755a78b57dadde2
4
- data.tar.gz: 9d951e8c68769591ec2c9e71381ac2bdbe738f6dd3556f84ec142a65c4be51d7
3
+ metadata.gz: 1feb00404603d98e5aa714c5d3eeeab9821c16922da68196b394166c96180869
4
+ data.tar.gz: 1d1b3c9db92ab5eae322e3803294eb689f81064a8625f16ea2d24d78bbdafc9d
5
5
  SHA512:
6
- metadata.gz: cae9f13a0f6a587fb5cf89a01c076aff1ebbc2830ef7e5fbe34be02537109fc13a977b9b938e711e5a64de90b038f889272f1ac134badc31f127273ddea74365
7
- data.tar.gz: 8453cae98b137ce6fe6c985351aaef8676153872ac03ebff4d8a47286c60c3f726dd7f42c86b37f7499d2de19a905068dc41e47526cb5c249af399eb63321532
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.2"
4
+ VERSION = "1.0.3"
5
5
  end
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.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Unnikrishnan KP
@@ -63,6 +63,7 @@ files:
63
63
  - lib/secvault/tasks.rake
64
64
  - lib/secvault/version.rb
65
65
  - secvault-1.0.1.gem
66
+ - secvault-1.0.2.gem
66
67
  - sig/secvault.rbs
67
68
  homepage: https://github.com/unnitallman/secvault
68
69
  licenses: