diff options
author | Yoshiyuki Hirano <yhirano@me.com> | 2018-02-09 10:40:25 +0900 |
---|---|---|
committer | Yoshiyuki Hirano <yhirano@me.com> | 2018-02-09 15:38:44 +0900 |
commit | 14696573499c1b148995d69e89867075561b229b (patch) | |
tree | 0612c32fe692252aae8777d8b7309c1b99275661 /railties/lib/rails | |
parent | 52c9af6c51fbf686762ad2330f36fe9f8ce3c5d7 (diff) | |
download | rails-14696573499c1b148995d69e89867075561b229b.tar.gz rails-14696573499c1b148995d69e89867075561b229b.tar.bz2 rails-14696573499c1b148995d69e89867075561b229b.zip |
Use heredoc with credentials template
* Use heredoc with credentials template.
* Fix indentation for aws config
Diffstat (limited to 'railties/lib/rails')
-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 |