无法理解 secret_token 的 rails 弃用警告

Obr*_*ios 2 ruby-on-rails stripe-payments

升级后rails 5.1rails 5.2.3我收到此弃用警告:

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
Run Code Online (Sandbox Code Playgroud)

如果我查看条带初始值设定项,我有:

Rails.configuration.stripe = {
  publishable_key: Rails.application.secrets.stripe_publishable_key,
  secret_key:      Rails.application.secrets.stripe_secret_key
}
Run Code Online (Sandbox Code Playgroud)

所以没有提到secret.token。如果我看config.secrets.yml我有

test:
  secret_key_base: some-key
  stripe_secret_key: another_key
  stripe_publishable_key: yet_another_key
Run Code Online (Sandbox Code Playgroud)

那么为什么我会收到弃用警告?

dha*_*esh 5

Rails 5.2 已用凭据替换机密,以在存储库中存储加密凭据或 API 密钥。您可以在以下文章中阅读有关从机密更改为凭据的更多信息。

https://medium.com/@wintermeyer/goodbye-secrets-welcome-credentials-f4709d9f4698

尽管 Rails 5.2 已用凭据替换了机密,但您仍然可以根据需要使用机密。但是,正如警告消息所述,秘密将从 Rails 6 中删除,您必须接受使用凭据来存储 API 密钥和 secret_keys。