diff options
author | Yuji Yaginuma <yuuji.yaginuma@gmail.com> | 2018-02-09 16:59:45 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-09 16:59:45 +0900 |
commit | 172c80dfd98d0a5443e6dd8eaa8b9e4f147149d9 (patch) | |
tree | 0612c32fe692252aae8777d8b7309c1b99275661 /railties | |
parent | 52c9af6c51fbf686762ad2330f36fe9f8ce3c5d7 (diff) | |
parent | 14696573499c1b148995d69e89867075561b229b (diff) | |
download | rails-172c80dfd98d0a5443e6dd8eaa8b9e4f147149d9.tar.gz rails-172c80dfd98d0a5443e6dd8eaa8b9e4f147149d9.tar.bz2 rails-172c80dfd98d0a5443e6dd8eaa8b9e4f147149d9.zip |
Merge pull request #31942 from yhirano55/use_heredoc_with_credentials_template
Use heredoc with credentials template
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/rails/credentials/credentials_generator.rb | 12 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb | 8 |
2 files changed, 16 insertions, 4 deletions
diff --git a/railties/lib/rails/generators/rails/credentials/credentials_generator.rb b/railties/lib/rails/generators/rails/credentials/credentials_generator.rb index 915115b63a..0fb4d5fbd1 100644 --- a/railties/lib/rails/generators/rails/credentials/credentials_generator.rb +++ b/railties/lib/rails/generators/rails/credentials/credentials_generator.rb @@ -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 @@ module Rails 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 diff --git a/railties/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb b/railties/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb index 85b3663fba..ef398f52a1 100644 --- a/railties/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb +++ b/railties/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb @@ -1,6 +1,7 @@ # 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 @@ module Rails 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 |