rails_key_rotator 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4716f503c795d3a21fe6fb7eff53ec6ebb0d003e34bad0dc2a68d6e652dfc7c9
4
- data.tar.gz: 194d519cf4e0278adb5cb60c183980712d027fc8ae8f85a8d7b4fe88df78a1ed
3
+ metadata.gz: c1583daf18681adbf057da6b49f0b1d31edde595911bae83460fd0ca7088d38f
4
+ data.tar.gz: 28024ed59be4ed43b9476eb3c0927a0a0a16370949a4c6bb1b98caf4f1ae770e
5
5
  SHA512:
6
- metadata.gz: '04485eed8bc71a9d664b0e4c8348cca4f4a8ba3c4d79fc29ac585f1c2fc2c7bc792bfc0b5e881643c0399dae0f7ea197a5d7f6b08ba00fa696b9d45e049659ca'
7
- data.tar.gz: 7bec424314fdc836d644547f08dd9299a6c34a615585168847f6c7e5b77fceafbe909d0fb7e581f827a2c0ea5bb7506e2ed780aa9628e75f349d0f85d63197b9
6
+ metadata.gz: b54587fcd4c6f39ed55143893c66550222e08eb1e2a6db07a1cafa3e574e78a47ad726b4d4b7cb6c9c24a7a2218ec5ba2054206ca0e30f7830638e56424c08de
7
+ data.tar.gz: 1a02f4f16ebe9ca906b587d2654358282febe8ed5c17348945989a583d70475eb5418a7aaaf4dd8cb9875bd94462124221f0705ea8166e48745527c98b0ebc18
@@ -5,7 +5,7 @@ require "rails"
5
5
  module RailsKeyRotator
6
6
  class Railtie < Rails::Railtie
7
7
  config.before_initialize do
8
- KeyRotator.rotated?
8
+ RailsKeyRotator.rotated?
9
9
  end
10
10
  rake_tasks do
11
11
  load "tasks/key_rotator.rake"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsKeyRotator
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.3"
5
5
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_key_rotator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leon Berenschot