secvault 1.0.3 → 1.0.4

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: 1feb00404603d98e5aa714c5d3eeeab9821c16922da68196b394166c96180869
4
- data.tar.gz: 1d1b3c9db92ab5eae322e3803294eb689f81064a8625f16ea2d24d78bbdafc9d
3
+ metadata.gz: 4516ca420928dd1fba6fbdd3a5b1a7def3068872f6b8a1f8ac82aac987405af0
4
+ data.tar.gz: 1a252a86fc1552b3c989a3d9a3ecee78fa11b14ef4989040e6d2c28f7c16819c
5
5
  SHA512:
6
- metadata.gz: f74172837da3d461a3022574678b79ff322afb0cfa87bab3f5c09ddac4d5eff508fa573b67fe15571122c93ec62611f23405117ec2e33092fe1d61a1ad615ab1
7
- data.tar.gz: 353b087160697768744a51a1404bf30f2c8b1e7ca22e9d95c833088b003a44fb0e897f03f57dd1df780c193e2f8c81b0a5b41323a23d2ea10730de1599cad817
6
+ metadata.gz: fa4565bff45f90436ae9255df05282e577dead6bfbcd7c6bda821e687d91d47b07ad7bb99ea113b63c23b1b2e79f1307cdafb46be515d04f632d656e24b0c803
7
+ data.tar.gz: c241e60c7334f8f9c589f3151c78a75f9c9a053e849e5c5820de71d5db053fbced5b507aec5411b703c7c01dff5688393068223947719e09593a974f229862a9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.0.4] - 2025-09-22
4
+
5
+ ### Added
6
+
7
+ - Comprehensive Rails 7.1 integration support
8
+ - New `Secvault.setup_rails_71_integration!` helper method for easy Rails 7.1 setup
9
+ - Enhanced documentation with Rails 7.1 integration guide
10
+ - Module-level documentation with usage examples and version compatibility
11
+
12
+ ### Improved
13
+
14
+ - Better Rails 7.1 compatibility with automatic detection and setup
15
+ - Enhanced README with Rails 7.1 integration section
16
+ - Improved error handling and logging for Rails 7.1 integration
17
+ - More comprehensive inline documentation
18
+
19
+ ### Changed
20
+
21
+ - Refined automatic setup logic to avoid conflicts with Rails 7.1 native functionality
22
+ - Updated gemspec description to include Rails 7.1+ support
23
+
24
+ ## [1.0.3] - 2025-09-22
25
+
26
+ ### Fixed
27
+
28
+ - Rails 7.1 compatibility issues with native Rails::Secrets conflicts
29
+ - String path handling in parse method
30
+ - Zeitwerk constant name mismatch resolution
31
+
32
+ ### Added
33
+
34
+ - Manual setup method for Rails 7.1 (opt-in)
35
+ - Rails version detection for automatic setup decisions
36
+ - Only create Rails::Secrets alias for Rails 7.2+ to avoid conflicts
37
+
38
+ ## [1.0.2] - 2025-09-22
39
+
40
+ ### Changed
41
+
42
+ - Updated Rails dependency from >= 7.2.0 to >= 7.1.0 for broader compatibility
43
+ - Updated gem description to include Rails 7.1+ support
44
+
45
+ ## [1.0.1] - 2025-09-22
46
+
47
+ ### Fixed
48
+
49
+ - Zeitwerk constant name mismatch in rails_secrets.rb
50
+ - Changed module definition from Rails::Secrets to Secvault::RailsSecrets
51
+ - Added Rails::Secrets alias for backward compatibility
52
+ - Resolved Zeitwerk::NameError when loading Rails applications
53
+
3
54
  ## [1.0.0] - 2025-09-22
4
55
 
5
56
  ### Added
data/README.md CHANGED
@@ -29,6 +29,12 @@ And then execute:
29
29
  $ bundle install
30
30
  ```
31
31
 
32
+ ### Rails Version Compatibility
33
+
34
+ - **Rails 7.2+**: Automatic setup, drop-in replacement for removed secrets functionality
35
+ - **Rails 7.1**: Manual setup required (see Rails 7.1 Integration section below)
36
+ - **Rails 8.0+**: Full compatibility
37
+
32
38
  ## Setup
33
39
 
34
40
  ### 1. Generate secrets file
@@ -147,6 +153,69 @@ ENV RAILS_SECRETS_KEY=your_encryption_key
147
153
  | `rake secvault:edit` | Edit the encrypted secrets file |
148
154
  | `rake secvault:show` | Display decrypted secrets content |
149
155
 
156
+ ## Rails 7.1 Integration
157
+
158
+ For Rails 7.1 applications, Secvault provides a simple integration method to replace the native Rails::Secrets functionality and test Secvault before upgrading to Rails 7.2+.
159
+
160
+ ### Quick Setup (Recommended)
161
+
162
+ Add this to `config/initializers/secvault.rb`:
163
+
164
+ ```ruby
165
+ # config/initializers/secvault.rb
166
+ Secvault.setup_rails_71_integration!
167
+ ```
168
+
169
+ That's it! This single line will:
170
+ - Override native Rails::Secrets with Secvault implementation
171
+ - Replace Rails.application.secrets with Secvault functionality
172
+ - Load secrets from config/secrets.yml automatically
173
+
174
+ ### Manual Setup (Advanced)
175
+
176
+ If you prefer more control, you can set it up manually:
177
+
178
+ ```ruby
179
+ # config/initializers/secvault.rb
180
+ module Rails
181
+ remove_const(:Secrets) if defined?(Secrets)
182
+ Secrets = Secvault::RailsSecrets
183
+ end
184
+
185
+ Rails.application.config.after_initialize do
186
+ secrets_path = Rails.root.join("config/secrets.yml")
187
+
188
+ if secrets_path.exist?
189
+ loaded_secrets = Rails::Secrets.parse([secrets_path], env: Rails.env)
190
+ secrets_object = ActiveSupport::OrderedOptions.new
191
+ secrets_object.merge!(loaded_secrets)
192
+
193
+ Rails.application.define_singleton_method(:secrets) do
194
+ secrets_object
195
+ end
196
+ end
197
+ end
198
+ ```
199
+
200
+ ### Rails 7.1 Benefits
201
+
202
+ ✅ **Test before upgrading**: Validate Secvault works with your secrets
203
+ ✅ **Zero code changes**: Existing Rails 7.1 code continues to work
204
+ ✅ **Smooth migration**: Gradual transition to Rails 7.2+
205
+ ✅ **Full compatibility**: All Rails.application.secrets functionality preserved
206
+
207
+ ### Example Rails 7.1 Usage
208
+
209
+ ```ruby
210
+ # Works exactly like native Rails 7.1
211
+ Rails.application.secrets.api_key
212
+ Rails.application.secrets.oauth_settings[:google_client_id]
213
+
214
+ # Plus enhanced Secvault functionality
215
+ Rails::Secrets.parse_default(env: 'development')
216
+ Rails::Secrets.parse([custom_path], env: Rails.env)
217
+ ```
218
+
150
219
  ## Migration from Rails < 7.2
151
220
 
152
221
  If you're upgrading from an older Rails version that had `secrets.yml`:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Secvault
4
- VERSION = "1.0.3"
4
+ VERSION = "1.0.4"
5
5
  end
data/lib/secvault.rb CHANGED
@@ -12,6 +12,42 @@ require_relative "secvault/version"
12
12
  loader = Zeitwerk::Loader.for_gem
13
13
  loader.setup
14
14
 
15
+ # Secvault - Enhanced secrets management for Rails
16
+ #
17
+ # Secvault restores the classic Rails secrets.yml functionality that was removed
18
+ # in Rails 7.2, allowing you to manage encrypted secrets using the familiar
19
+ # YAML-based approach.
20
+ #
21
+ # ## Rails Version Support:
22
+ # - Rails 7.1: Requires manual setup (see Rails 7.1 integration guide)
23
+ # - Rails 7.2+: Automatic setup, drop-in replacement for removed functionality
24
+ # - Rails 8.0+: Full compatibility
25
+ #
26
+ # ## Rails 7.1 Integration:
27
+ # For Rails 7.1 apps, add this initializer to override native Rails::Secrets:
28
+ #
29
+ # # config/initializers/secvault.rb
30
+ # module Rails
31
+ # remove_const(:Secrets) if defined?(Secrets)
32
+ # Secrets = Secvault::RailsSecrets
33
+ # end
34
+ #
35
+ # Rails.application.config.after_initialize do
36
+ # secrets_path = Rails.root.join("config/secrets.yml")
37
+ # if secrets_path.exist?
38
+ # loaded_secrets = Rails::Secrets.parse([secrets_path], env: Rails.env)
39
+ # secrets_object = ActiveSupport::OrderedOptions.new
40
+ # secrets_object.merge!(loaded_secrets)
41
+ # Rails.application.define_singleton_method(:secrets) { secrets_object }
42
+ # end
43
+ # end
44
+ #
45
+ # ## Usage:
46
+ # Rails.application.secrets.api_key
47
+ # Rails.application.secrets.oauth_settings[:google_client_id]
48
+ # Rails::Secrets.parse_default(env: 'development')
49
+ #
50
+ # @see https://github.com/unnitallman/secvault
15
51
  module Secvault
16
52
  class Error < StandardError; end
17
53
  class MissingKeyError < Error; end
@@ -25,6 +61,51 @@ module Secvault
25
61
  require "secvault/railtie"
26
62
  require "secvault/rails_secrets"
27
63
  end
64
+
65
+ # Helper method to set up Secvault for Rails 7.1 applications
66
+ # This provides an easy way to integrate Secvault into Rails 7.1 apps
67
+ # that still have native Rails::Secrets functionality.
68
+ #
69
+ # Usage in an initializer:
70
+ # Secvault.setup_rails_71_integration!
71
+ #
72
+ # This will:
73
+ # 1. Override native Rails::Secrets with Secvault implementation
74
+ # 2. Replace Rails.application.secrets with Secvault-powered functionality
75
+ # 3. Load secrets from config/secrets.yml automatically
76
+ def setup_rails_71_integration!
77
+ # Override native Rails::Secrets
78
+ if defined?(Rails::Secrets)
79
+ Rails.send(:remove_const, :Secrets)
80
+ end
81
+ Rails.const_set(:Secrets, Secvault::RailsSecrets)
82
+
83
+ # Set up Rails.application.secrets replacement
84
+ Rails.application.config.after_initialize do
85
+ secrets_path = Rails.root.join("config/secrets.yml")
86
+
87
+ if secrets_path.exist?
88
+ # Load secrets using Secvault
89
+ loaded_secrets = Rails::Secrets.parse([secrets_path], env: Rails.env)
90
+
91
+ # Create ActiveSupport::OrderedOptions object for compatibility
92
+ secrets_object = ActiveSupport::OrderedOptions.new
93
+ secrets_object.merge!(loaded_secrets)
94
+
95
+ # Replace Rails.application.secrets
96
+ Rails.application.define_singleton_method(:secrets) do
97
+ secrets_object
98
+ end
99
+
100
+ # Log integration success (except in production)
101
+ unless Rails.env.production?
102
+ Rails.logger&.info "[Secvault] Rails 7.1 integration complete. Loaded #{loaded_secrets.keys.size} secret keys."
103
+ end
104
+ else
105
+ Rails.logger&.warn "[Secvault] No secrets.yml file found at #{secrets_path}"
106
+ end
107
+ end
108
+ end
28
109
  end
29
110
 
30
111
  Secvault.install! if defined?(Rails)
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.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Unnikrishnan KP
@@ -62,8 +62,6 @@ 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
67
65
  - sig/secvault.rbs
68
66
  homepage: https://github.com/unnitallman/secvault
69
67
  licenses:
data/secvault-1.0.1.gem DELETED
Binary file
data/secvault-1.0.2.gem DELETED
Binary file