[英]Rails app deployed on Centos w/ standalone Passenger and Capistrano can't access ENV variables
[英]ENV variables in bash - why can't I access them in my Rails local setup?
我在.bash_profile中设置了Stripe Publishable和Secret Key,它们在bash中显示得很好。
> echo $STRIPE_TEST_SECRET_KEY
sk_test_bunchofcharacters
但是在我的stripe.rb文件中,它们没有被访问。
Rails.configuration.stripe = {
:publishable_key => ENV['STRIPE_TEST_PUBLISHABLE_KEY'],
:secret_key => ENV['STRIPE_TEST_SECRET_KEY'],
}
Stripe.api_key = Rails.configuration.stripe[:secret_key]
byebug
我想念哪一块?
当我执行heroku config以及所有其他操作时,一切在生产中都可以正常工作...这只是本地安装带来的麻烦。
PS变量也不显示在我的rails控制台中。
尝试停止服务器,然后键入spring stop
以也停止Spring,然后再次启动服务器。 我认为环境变量仅在Spring启动时加载。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.