Skip to content

Fix: Do not override config.credentials when invoking rails credentials commands #11

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

Merged
merged 1 commit into from
Jun 2, 2025

Conversation

tangrufus
Copy link
Member

No description provided.

@tangrufus tangrufus added the bug Something isn't working label Jun 2, 2025
@tangrufus tangrufus force-pushed the fix-rails-credentials branch from 7143d95 to 9ca8223 Compare June 2, 2025 20:38
@tangrufus tangrufus enabled auto-merge (squash) June 2, 2025 20:40
@tangrufus tangrufus requested a review from Copilot June 2, 2025 20:41
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the overriding issue of Rails.application.config.credentials when running rails credentials commands. It updates the credentials initialization logic to back up the original credentials, adjusts tests to verify the new behavior, and updates the railtie initialization and documentation accordingly.

  • Updates credentials initialization and error handling logic.
  • Adjusts test cases and file helpers to verify the new behavior.
  • Enhances documentation regarding usage of the --environment option.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/units/app_env/credentials_test.rb Updates tests to verify new behavior using configuration instead.
test/features/file_helpers.rb Refactors file helper methods and adds new file assertions.
test/features/credentials_command_test.rb Adds comprehensive tests covering various environment scenarios.
lib/rails/rails_ext/credentials_command.rb Provides a wrapper to expose backed-up credentials via config.
lib/rails/app_env/railtie.rb Refactors initializer callbacks to properly initialize credentials.
lib/rails/app_env/error.rb Introduces a base error class for AppEnv.
lib/rails/app_env/credentials.rb Updates initialization to backup original credentials and monkey-patches command.
README.md Updates documentation regarding the --environment option.

@tangrufus tangrufus force-pushed the fix-rails-credentials branch from 5404158 to 56e3bd4 Compare June 2, 2025 20:43
@tangrufus tangrufus force-pushed the fix-rails-credentials branch from 9ec74eb to 296f9ff Compare June 2, 2025 20:45
@tangrufus tangrufus merged commit 15a7183 into main Jun 2, 2025
8 checks passed
@tangrufus tangrufus deleted the fix-rails-credentials branch June 2, 2025 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

1 participant