提交 d1e3302f 编写于 作者: Y Yuji Yaginuma 提交者: yuuji.yaginuma

Merge pull request #31942 from yhirano55/use_heredoc_with_credentials_template

Use heredoc with credentials template
上级 9c6db8ad
......@@ -2,6 +2,7 @@
require "rails/generators/base"
require "rails/generators/rails/master_key/master_key_generator"
require "active_support/core_ext/string/strip"
require "active_support/encrypted_configuration"
module Rails
......@@ -42,9 +43,14 @@ def credentials
end
def credentials_template
"# aws:\n# access_key_id: 123\n# secret_access_key: 345\n\n" +
"# Used as the base secret for all MessageVerifiers in Rails, including the one protecting cookies.\n" +
"secret_key_base: #{SecureRandom.hex(64)}"
<<-YAML.strip_heredoc
# aws:
# access_key_id: 123
# secret_access_key: 345
# Used as the base secret for all MessageVerifiers in Rails, including the one protecting cookies.
secret_key_base: #{SecureRandom.hex(64)}
YAML
end
end
end
......
# frozen_string_literal: true
require "rails/generators/base"
require "active_support/core_ext/string/strip"
require "active_support/encrypted_file"
module Rails
......@@ -15,7 +16,12 @@ def add_encrypted_file_silently(file_path, key_path, template = encrypted_file_t
private
def encrypted_file_template
"# aws:\n# access_key_id: 123\n# secret_access_key: 345\n\n"
<<-YAML.strip_heredoc
# aws:
# access_key_id: 123
# secret_access_key: 345
YAML
end
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册