0

This is my engine.rb file. I am able to access Figaro variable in the middleware. But the Stripe.api_key=Figaro.env.stripe_secret is not working. Stripe api_key not set error is being shown .

  module Stripo

      require 'figaro'

      class Engine < ::Rails::Engine
        isolate_namespace Stripo
        Stripe.api_key=Figaro.env.stripe_secret
        middleware.use OmniAuth::Builder do
          provider :stripe_connect, Figaro.env.client_id,Figaro.env.stripe_secret,:scope => 'read_write'
        end

     end
  end

How can I set Stripe api_key from Figaro variable in my engine?

raj
  • 5,989
  • 7
  • 30
  • 62
  • `Stripe.api_key= ENV['stripe_secret']` should work fine, provided that the key for your stripe secret number is saved inside your `application.yml` as `stripe_secret`. – x6iae Nov 13 '15 at 12:11
  • It doesnt work. I am working on an engine. And the above code is written inside engine.rb – raj Nov 13 '15 at 12:50
  • What about `ENV.fetch('stripe_secret')`? – x6iae Nov 13 '15 at 13:21
  • Can you show an example of your `application.yml`? – x6iae Nov 13 '15 at 13:23
  • This didnt work . So I added an initializers folder and set api key there. – raj Nov 13 '15 at 18:10
  • ` publishable_key: "pk_tebEEAxS0Wb2Sd8IB1LpAjs" client_id: "ca_7CmEzS4NfEz4PNkiwAUhvBA9gQ" stripe_secret: "sk_test_o9YlLXk88DfsdQtPEqZ" ` this is my application.yml – raj Nov 13 '15 at 18:12
  • DId you ever solve this? @raj – Waclock Dec 16 '16 at 17:28

0 Answers0