aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorYuji Yaginuma <yuuji.yaginuma@gmail.com>2019-03-24 09:44:13 +0900
committerGitHub <noreply@github.com>2019-03-24 09:44:13 +0900
commit122853dc54c669fcb2ee4d73f533cddf35f91131 (patch)
treed3580650de59ff6ea64341873a961bfd0e1f8cd1 /railties/lib
parentff7948b1c2cbdf5527e40e60a4f2ef7621445d55 (diff)
parent0e9e59953fa5360750287fe45a102633f7e54f2b (diff)
downloadrails-122853dc54c669fcb2ee4d73f533cddf35f91131.tar.gz
rails-122853dc54c669fcb2ee4d73f533cddf35f91131.tar.bz2
rails-122853dc54c669fcb2ee4d73f533cddf35f91131.zip
Merge pull request #35718 from y-yagi/add_secret_key_base_when_creating_new_credentials
Add `secret_key_base` when creating new credential file
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/commands/credentials/credentials_command.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/railties/lib/rails/commands/credentials/credentials_command.rb b/railties/lib/rails/commands/credentials/credentials_command.rb
index a22b1f3f84..e23a1b3008 100644
--- a/railties/lib/rails/commands/credentials/credentials_command.rb
+++ b/railties/lib/rails/commands/credentials/credentials_command.rb
@@ -56,7 +56,11 @@ module Rails
end
def ensure_credentials_have_been_added
- encrypted_file_generator.add_encrypted_file_silently(content_path, key_path)
+ if options[:environment]
+ encrypted_file_generator.add_encrypted_file_silently(content_path, key_path)
+ else
+ credentials_generator.add_credentials_file_silently
+ end
end
def change_credentials_in_system_editor
@@ -96,6 +100,13 @@ module Rails
Rails::Generators::EncryptedFileGenerator.new
end
+
+ def credentials_generator
+ require "rails/generators"
+ require "rails/generators/rails/credentials/credentials_generator"
+
+ Rails::Generators::CredentialsGenerator.new
+ end
end
end
end