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

Environment-specific credentials #31349

Closed
mrsweaters opened this issue Dec 6, 2017 · 3 comments
Closed

Environment-specific credentials #31349

mrsweaters opened this issue Dec 6, 2017 · 3 comments

Comments

@mrsweaters
Copy link

mrsweaters commented Dec 6, 2017

Steps to reproduce

Run Rails.application.credentials from the console from any environment.

Expected behavior

Rails.application.secrets will return environment specific secrets from secrets.yml if they are name spaced by environment.

I would expect Rails.application.credentials to do the same. There are instances where data like third-party API keys are still unique to the loaded environment. It would be nice to be able to store these in the encrypted credentials as well.

Instead of having to do this:

Rails.application.credentials[Rails.env].my_credential

This is preferred:

Rails.application.credentials.my_credential

With a credentials file structured like this:

development:
  my_credential: token
test:
  my_credential: token
production:
  my_credential: token

Actual behavior

Rails.application.credentials returns all credentials at root level.

System configuration

Rails version: 5.2.0.beta2

Ruby version: 2.4.2

@y-yagi
Copy link
Member

y-yagi commented Dec 6, 2017

This is intentional behavior. For details, please see the description of #30067.

Also, please use the mailing list or StackOverflow for questions/help, where a wider community will be able to help you. We reserve the issues tracker for issues only. Thanks!

@y-yagi y-yagi closed this as completed Dec 6, 2017
@mrsweaters
Copy link
Author

@y-yagi Definitely disagree with the decision there. Will follow up in that discussion. Thanks for pointing me in the right direction!

@jpatters
Copy link

A reference for anyone else who lands here:
#33521

This has been added for rails 6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants