【发布时间】:2018-01-04 22:58:58
【问题描述】:
我在我的应用程序上设置了 Stripe,以便它在测试模式下在 localhost 和 Heroku 上完美运行。我已经在 Stripe 上切换到实时模式,并使用Stripe documentation 中的这些步骤更新我的stripe_api_key 和stripe_publishable_key:
heroku config:set PUBLISHABLE_KEY=pk_live_... SECRET_KEY=sk_live_...
我也对 stripe_api_key 和 stripe_publishable_key 进行了此操作,正如我在其他文档中看到的那样,并希望涵盖我的基础。
我的application.example.yml 中有以下内容:
stripe_api_key:
stripe_publishable_key:
production:
stripe_api_key:
stripe_publishable_key:
SENDGRID_USERNAME:
SENDGRID_PASSWORD:
AWS_ACCESS_KEY_ID:
AWS_REGION:
AWS_SECRET_ACCESS_KEY:
S3_BUCKET_NAME:
而application.yml有对应的信息。我的stripe.rb 看起来像这样:
Rails.configuration.stripe = {
:publishable_key => Rails.application.secrets.publishable_key,
:secret_key => Rails.application.secrets.secret_key
}
Stripe.api_key = Rails.configuration.stripe[:secret_key]
谁能看到为什么 Stripe 仍在 Heroku 的生产服务器上以测试模式运行?
【问题讨论】:
-
您在设置这些密钥后是否重新启动了服务器?
heroku restart -a your-app -
@AbM,是的。我多次重新启动整个应用程序。
标签: ruby-on-rails heroku stripe-payments