有些人在应用程序在/config/environments
内启动时初始化活动商家网关,如下所示:
config.after_initialize do
paypal_options = {
login: ENV['PAYPAL_LOGIN'],
password: ENV['PAYPAL_PASSWORD'],
signature: ENV['PAYPAL_SIGNATURE']
}
::EXPRESS_GATEWAY = ActiveMerchant::Billing::PaypalExpressGateway.new(paypal_options)
end
有些人只在需要时才使用私有方法启动它:
paypal_express_params = {
login: ENV['PAYPAL_LOGIN'],
password: ENV['PAYPAL_PASSWORD'],
signature: ENV['PAYPAL_SIGNATURE']
}
gateway = ActiveMerchant::Billing::PaypalExpressGateway.new(paypal_express_params)
最安全的选择是什么?为什么?