rails_key_rotator 0.2.2 → 0.2.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/rails_key_rotator/railtie.rb +1 -1
- data/lib/rails_key_rotator/version.rb +1 -1
- data/lib/rails_key_rotator.rb +3 -2
- 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: c1583daf18681adbf057da6b49f0b1d31edde595911bae83460fd0ca7088d38f
|
4
|
+
data.tar.gz: 28024ed59be4ed43b9476eb3c0927a0a0a16370949a4c6bb1b98caf4f1ae770e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b54587fcd4c6f39ed55143893c66550222e08eb1e2a6db07a1cafa3e574e78a47ad726b4d4b7cb6c9c24a7a2218ec5ba2054206ca0e30f7830638e56424c08de
|
7
|
+
data.tar.gz: 1a02f4f16ebe9ca906b587d2654358282febe8ed5c17348945989a583d70475eb5418a7aaaf4dd8cb9875bd94462124221f0705ea8166e48745527c98b0ebc18
|
data/lib/rails_key_rotator.rb
CHANGED
@@ -27,8 +27,8 @@ module RailsKeyRotator
|
|
27
27
|
def rotate
|
28
28
|
puts "Starting process:"
|
29
29
|
decrypted = read(credentials_path) # Decrypt current credentials
|
30
|
-
backup_file(key_path) # Backup key
|
31
30
|
backup_file(credentials_path) # Backup credentials
|
31
|
+
backup_file(key_path) # Backup key
|
32
32
|
write_key # Save new key
|
33
33
|
write_credentials(decrypted) # Save new credentials
|
34
34
|
puts <<~PROCEDURE
|
@@ -89,6 +89,7 @@ module RailsKeyRotator
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def backup_file(original)
|
92
|
+
raise "File does not exist: #{original}" unless File.exist?(original)
|
92
93
|
say "Copy #{original} -> #{original}.bak-#{date}"
|
93
94
|
FileUtils.mv(original, "#{original}.bak-#{date}")
|
94
95
|
end
|
@@ -97,7 +98,7 @@ module RailsKeyRotator
|
|
97
98
|
ActiveSupport::EncryptedConfiguration.new(
|
98
99
|
config_path: credentials_path,
|
99
100
|
key_path: key_path,
|
100
|
-
env_key: "",
|
101
|
+
env_key: "RAILS_MASTER_KEY",
|
101
102
|
raise_if_missing_key: true
|
102
103
|
).read
|
103
104
|
end
|