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 +4 -4
- data/lib/secvault/rails_secrets.rb +11 -2
- data/lib/secvault/secrets.rb +24 -0
- data/lib/secvault/version.rb +1 -1
- data/secvault-1.0.2.gem +0 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1feb00404603d98e5aa714c5d3eeeab9821c16922da68196b394166c96180869
|
4
|
+
data.tar.gz: 1d1b3c9db92ab5eae322e3803294eb689f81064a8625f16ea2d24d78bbdafc9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
52
|
-
|
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
|
data/lib/secvault/secrets.rb
CHANGED
@@ -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
|
data/lib/secvault/version.rb
CHANGED
data/secvault-1.0.2.gem
ADDED
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.
|
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:
|