Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix indentation in the template for secrets #30370

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion railties/lib/rails/secrets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def template
<<-end_of_template.strip_heredoc
# See `secrets.yml` for tips on generating suitable keys.
# production:
# external_api_key: 1466aac22e6a869134be3d09b9e89232fc2c2289
# external_api_key: 1466aac22e6a869134be3d09b9e89232fc2c2289

end_of_template
end
Expand Down
4 changes: 2 additions & 2 deletions railties/test/generators/encrypted_secrets_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def test_generates_key_file_and_encrypted_secrets_file
assert_file "config/secrets.yml.key", /\w+/

assert File.exist?("config/secrets.yml.enc")
assert_no_match(/production:\n# external_api_key: \w+/, IO.binread("config/secrets.yml.enc"))
assert_match(/production:\n# external_api_key: \w+/, Rails::Secrets.read)
assert_no_match(/# production:\n# external_api_key: \w+/, IO.binread("config/secrets.yml.enc"))
assert_match(/# production:\n# external_api_key: \w+/, Rails::Secrets.read)
end

def test_appends_to_gitignore
Expand Down
4 changes: 2 additions & 2 deletions railties/test/secrets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def teardown
ENV["RAILS_MASTER_KEY"] = IO.binread("config/secrets.yml.key").strip
FileUtils.rm("config/secrets.yml.key")

assert_match "production:\n# external_api_key", Rails::Secrets.read
assert_match "# production:\n# external_api_key:", Rails::Secrets.read
ensure
ENV["RAILS_MASTER_KEY"] = old_key
end
Expand All @@ -69,7 +69,7 @@ def teardown
Rails::Secrets.read_for_editing do |tmp_path|
decrypted_path = tmp_path

assert_match(/production:\n# external_api_key/, File.read(tmp_path))
assert_match(/# production:\n# external_api_key/, File.read(tmp_path))

File.write(tmp_path, "Empty streets, empty nights. The Downtown Lights.")
end
Expand Down