After upgrading from rails 5.1
to rails 5.2.3
I am getting this deprecation warning:
secrets.secret_token` is deprecated in favor of `secret_key_base` and will be removed in Rails 6.0. (called from <main> at /config/initializers/stripe.rb:3
If I look at the stripe initializer, I have:
Rails.configuration.stripe = {
publishable_key: Rails.application.secrets.stripe_publishable_key,
secret_key: Rails.application.secrets.stripe_secret_key
}
so there is no mention of secret.token
. If I look at config.secrets.yml
I have
test:
secret_key_base: some-key
stripe_secret_key: another_key
stripe_publishable_key: yet_another_key
So why am I getting the deprecation warning?
Rails 5.2 has replaced secrets with credentials to store encrypted credentials or API keys in the repository. You can read more about the changing from secrets to credentials in the following article.
https://medium.com/@wintermeyer/goodbye-secrets-welcome-credentials-f4709d9f4698
Even though Rails 5.2 has replaced secrets with credentials, you can still use secrets if you wish to. However as the warning message states, secrets will be removed from Rails 6 and you have to embrace in using credentials for storing API keys and secret_keys.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With