I am using ruby 3.1.0 and rails 7.0.4, I have configured Figaro gem, but not able to access its keys in the rails console.
this is the application.yml content.
app/config/application.yml
production:
stripe_api_key: sk_live_EeHnL644i6zo4Iyq4v1KdV9H
stripe_publishable_key: pk_live_9lcthxpSIHbGwmdO941O1XVU
I need the value of the key in the rails console.
thank!
I have got the above answer, first, we need to start the rails console in production mode using the below command.
rails c or console -e production
then we can easily access the keys in the rails console.
ENV["stripe_api_key"]
=> "sk_live_EeHnL644i6zo4Iyq4v1KdV9H"
ENV["stripe_publishable_key"]
=> "pk_live_9lcthxpSIHbGwmdO941O1XVU"
this worked for me.
thanks!