secvault 2.1.0 → 2.2.0
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/CHANGELOG.md +29 -0
- data/README.md +35 -1
- data/lib/secvault/rails_secrets.rb +20 -22
- data/lib/secvault/version.rb +1 -1
- data/lib/secvault.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 243d63e08d1e0efc90840322ebe46d547a6733829e4cde6f009dcaee457fb141
|
|
4
|
+
data.tar.gz: 0c927adb97f3fdfa9e4680d59825b50b2741b11cb8131c1e61b0eca42dec75fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0abb15b103100f8205b1ec4c7890d51b9ad8d8c0f55d8d96e1f55b0e85b6d0ade146c382c32e187bfb2c952d02a3fc940ee33b9c6f9beabe598b7773e9cf9fa9
|
|
7
|
+
data.tar.gz: 12edf2aad07063edb1d4385bedcc8899d388eefef26499671cdddf2bc37c67bfeec39fc08729e09e19c63c04021f28642276f81354b1729a7e08940b5a47fcc9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [2.2.0] - 2025-09-22
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **New simplified API**: `Rails::Secrets.load()` - cleaner method to load default config/secrets.yml
|
|
8
|
+
- **Enhanced README** with comprehensive examples for multiple files usage
|
|
9
|
+
- **Better documentation** showing how to parse custom files and multiple file merging
|
|
10
|
+
- **Backward compatibility aliases** - `parse_default` and `read` still work
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **Improved method naming**: `Rails::Secrets.load()` is now the preferred method over `parse_default()`
|
|
15
|
+
- **Enhanced documentation** in code with clear examples for single file, multiple files, and custom paths
|
|
16
|
+
- **Better README examples** showing advanced usage patterns
|
|
17
|
+
|
|
18
|
+
### Examples Added
|
|
19
|
+
|
|
20
|
+
- Multiple secrets files merging: `Rails::Secrets.parse(['secrets.yml', 'secrets.local.yml'], env: Rails.env)`
|
|
21
|
+
- Environment-specific loading: `Rails::Secrets.load(env: 'production')`
|
|
22
|
+
- Custom file parsing: `Rails::Secrets.parse(['config/custom.yml'], env: Rails.env)`
|
|
23
|
+
- Multiple path support: `Rails::Secrets.parse([Rails.root.join('config', 'secrets.yml')], env: Rails.env)`
|
|
24
|
+
|
|
25
|
+
### Backward Compatibility
|
|
26
|
+
|
|
27
|
+
- ✅ All existing methods still work
|
|
28
|
+
- ✅ `parse_default` → `load` (alias maintained)
|
|
29
|
+
- ✅ `read` → `load` (alias maintained)
|
|
30
|
+
- ✅ No breaking changes
|
|
31
|
+
|
|
3
32
|
## [2.1.0] - 2025-09-22
|
|
4
33
|
|
|
5
34
|
### Removed
|
data/README.md
CHANGED
|
@@ -51,6 +51,39 @@ production:
|
|
|
51
51
|
api_key: <%= ENV['API_KEY'] %>
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
## Advanced Usage
|
|
55
|
+
|
|
56
|
+
**Multiple secrets files (merged in order):**
|
|
57
|
+
```ruby
|
|
58
|
+
# Parse multiple files - later files override earlier ones
|
|
59
|
+
secrets = Rails::Secrets.parse([
|
|
60
|
+
'config/secrets.yml',
|
|
61
|
+
'config/secrets.local.yml',
|
|
62
|
+
'config/secrets.production.yml'
|
|
63
|
+
], env: Rails.env)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Load specific environment:**
|
|
67
|
+
```ruby
|
|
68
|
+
# Load production secrets in any environment
|
|
69
|
+
production_secrets = Rails::Secrets.load(env: 'production')
|
|
70
|
+
|
|
71
|
+
# Load development secrets
|
|
72
|
+
dev_secrets = Rails::Secrets.load(env: 'development')
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Custom files:**
|
|
76
|
+
```ruby
|
|
77
|
+
# Parse a custom secrets file
|
|
78
|
+
custom_secrets = Rails::Secrets.parse(['config/custom.yml'], env: Rails.env)
|
|
79
|
+
|
|
80
|
+
# Parse from different paths
|
|
81
|
+
all_secrets = Rails::Secrets.parse([
|
|
82
|
+
Rails.root.join('config', 'secrets.yml'),
|
|
83
|
+
Rails.root.join('config', 'deploy', 'secrets.yml')
|
|
84
|
+
], env: Rails.env)
|
|
85
|
+
```
|
|
86
|
+
|
|
54
87
|
## Rails 7.1 Integration
|
|
55
88
|
|
|
56
89
|
Test Secvault in Rails 7.1 before upgrading to 7.2+:
|
|
@@ -65,7 +98,8 @@ This replaces Rails.application.secrets with Secvault functionality. Your existi
|
|
|
65
98
|
```ruby
|
|
66
99
|
Rails.application.secrets.api_key # ✅ Works
|
|
67
100
|
Rails.application.secrets.oauth_settings # ✅ Works
|
|
68
|
-
Rails::Secrets.
|
|
101
|
+
Rails::Secrets.load # ✅ Load default config/secrets.yml
|
|
102
|
+
Rails::Secrets.parse(['custom.yml'], env: Rails.env) # ✅ Parse custom files
|
|
69
103
|
```
|
|
70
104
|
|
|
71
105
|
|
|
@@ -7,43 +7,41 @@ module Secvault
|
|
|
7
7
|
module RailsSecrets
|
|
8
8
|
extend self
|
|
9
9
|
|
|
10
|
-
#
|
|
10
|
+
# Parse secrets from one or more YAML files
|
|
11
11
|
#
|
|
12
|
-
#
|
|
13
|
-
# - ERB templating
|
|
12
|
+
# Supports:
|
|
13
|
+
# - ERB templating for environment variables
|
|
14
14
|
# - Shared sections that apply to all environments
|
|
15
15
|
# - Environment-specific sections
|
|
16
|
+
# - Multiple files (merged in order)
|
|
16
17
|
# - Deep symbolized keys
|
|
17
18
|
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
# Example secrets.yml structure:
|
|
22
|
-
# shared:
|
|
23
|
-
# common_key: shared_value
|
|
19
|
+
# Examples:
|
|
20
|
+
# # Single file
|
|
21
|
+
# Rails::Secrets.parse(['config/secrets.yml'], env: 'development')
|
|
24
22
|
#
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
23
|
+
# # Multiple files (merged in order)
|
|
24
|
+
# Rails::Secrets.parse([
|
|
25
|
+
# 'config/secrets.yml',
|
|
26
|
+
# 'config/secrets.local.yml'
|
|
27
|
+
# ], env: 'development')
|
|
28
28
|
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
29
|
+
# # Load default config/secrets.yml
|
|
30
|
+
# Rails::Secrets.load # uses current Rails.env
|
|
31
|
+
# Rails::Secrets.load(env: 'production')
|
|
33
32
|
def parse(paths, env:)
|
|
34
33
|
Secvault::Secrets.parse(paths, env: env.to_s)
|
|
35
34
|
end
|
|
36
35
|
|
|
37
|
-
#
|
|
38
|
-
def
|
|
36
|
+
# Load secrets from the default config/secrets.yml file
|
|
37
|
+
def load(env: Rails.env)
|
|
39
38
|
secrets_path = Rails.root.join("config/secrets.yml")
|
|
40
39
|
parse([secrets_path], env: env)
|
|
41
40
|
end
|
|
42
41
|
|
|
43
|
-
#
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
end
|
|
42
|
+
# Backward compatibility aliases (deprecated)
|
|
43
|
+
alias_method :parse_default, :load
|
|
44
|
+
alias_method :read, :load
|
|
47
45
|
end
|
|
48
46
|
end
|
|
49
47
|
|
data/lib/secvault/version.rb
CHANGED
data/lib/secvault.rb
CHANGED
|
@@ -44,7 +44,8 @@ loader.setup
|
|
|
44
44
|
# ## Usage:
|
|
45
45
|
# Rails.application.secrets.api_key
|
|
46
46
|
# Rails.application.secrets.oauth_settings[:google_client_id]
|
|
47
|
-
# Rails::Secrets.
|
|
47
|
+
# Rails::Secrets.load(env: 'development') # Load default config/secrets.yml
|
|
48
|
+
# Rails::Secrets.parse(['custom.yml'], env: Rails.env) # Parse custom files
|
|
48
49
|
#
|
|
49
50
|
# ## Getting Started:
|
|
50
51
|
# 1. Create config/secrets.yml with your secrets
|