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

Use Rails Credentials mechanism for client secrets #206

Open
xeruf opened this issue Nov 18, 2023 · 0 comments
Open

Use Rails Credentials mechanism for client secrets #206

xeruf opened this issue Nov 18, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@xeruf
Copy link

xeruf commented Nov 18, 2023

Desired Behavior

Use the rails credentials mechanism (https://web-crunch.com/posts/the-complete-guide-to-ruby-on-rails-encrypted-credentials) to load credentials by default (maybe secondary to env variables), and encourage configuration via rails credentials:edit [--environment=ENV].

Something like:

paypal:
  client_id: XX
  client_secret: YYYY

This also eases putting in separate credentials for development and production.

(Optional) Current Behavior
As a developer inexperienced in Ruby on Rails, I did not know how to securly store my credentials, so they ended up in the commit history.
This case can quickly happen when following the current README instructions.

Workaround
This is what I do now, after arduously pruning my commit history and having learned the proper way:

    'paypal_commerce_platform_credentials', {
      test_mode: !Rails.env.production?,
      client_id: ENV['PAYPAL_CLIENT_ID'] || Rails.application.credentials.dig(:paypal, :client_id),
      client_secret: ENV['PAYPAL_CLIENT_SECRET'] || Rails.application.credentials.dig(:paypal, :client_secret),
@xeruf xeruf added the enhancement New feature or request label Nov 18, 2023
@xeruf xeruf changed the title Use Rails Credentials mechanism Use Rails Credentials mechanism for client secrets Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant