check env set

This commit is contained in:
Rimian Perkins 2017-02-16 16:43:21 +11:00
parent de9a5cb6f9
commit 0e0b452626
1 changed files with 12 additions and 4 deletions

View File

@ -1,6 +1,14 @@
Rails.configuration.stripe = {
:publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'] || Rails.application.config_for(:stripe)['publishable_key'],
:secret_key => ENV['STRIPE_SECRET_KEY'] || Rails.application.config_for(:stripe)['secret_key']
}
if ENV['STRIPE_SECRET_KEY'].present?
Rails.configuration.stripe = {
:publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'],
:secret_key => ENV['STRIPE_SECRET_KEY']
}
else
Rails.configuration.stripe = {
:publishable_key => Rails.application.config_for(:stripe)['publishable_key'],
:secret_key => Rails.application.config_for(:stripe)['secret_key']
}
end
Stripe.api_key = Rails.configuration.stripe[:secret_key]