diff options
author | elijah <elijah@riseup.net> | 2013-12-18 00:10:01 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2013-12-20 10:56:01 -0800 |
commit | 34ac576bf7efbddac0a89731292eac8974f95114 (patch) | |
tree | edc2b821602e5ea0310ae185eef4e9d6e710c843 /billing/config | |
parent | 76517637ddf70577bd2a14bebb8a57552fbb1776 (diff) |
enable billing engine by default, consolidate APP_CONFIG[:payments] and APP_CONFIG[:braintree] into APP_CONFIG[:billing][:braintree]
Diffstat (limited to 'billing/config')
-rw-r--r-- | billing/config/initializers/braintree.rb | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/billing/config/initializers/braintree.rb b/billing/config/initializers/braintree.rb index d6ae565..c0c89e2 100644 --- a/billing/config/initializers/braintree.rb +++ b/billing/config/initializers/braintree.rb @@ -1,16 +1,31 @@ -require 'braintree_test_app' - -Braintree::Configuration.logger = Logger.new('log/braintree.log') +# +# set logger +# +if APP_CONFIG[:logfile].blank? + require 'syslog/logger' + Braintree::Configuration.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new('webapp')) +else + Braintree::Configuration.logger = Logger.new('log/braintree.log') +end +# # we use fake braintree in tests +# if Rails.env.test? + require 'braintree_test_app' Rails.application.config.middleware.use BraintreeTestApp end +# # You can set these per environment in config/config.yml: -if braintree_conf = APP_CONFIG[:braintree] - Braintree::Configuration.environment = braintree_conf[:environment] - Braintree::Configuration.merchant_id = braintree_conf[:merchant_id] - Braintree::Configuration.public_key = braintree_conf[:public_key] - Braintree::Configuration.private_key = braintree_conf[:private_key] +# +# Environment must be one of: :development, :qa, :sandbox, :production +# +if billing = APP_CONFIG[:billing] + if braintree = billing[:braintree] + Braintree::Configuration.environment = braintree[:environment].downcase.to_sym + Braintree::Configuration.merchant_id = braintree[:merchant_id] + Braintree::Configuration.public_key = braintree[:public_key] + Braintree::Configuration.private_key = braintree[:private_key] + end end |