I m trying to use Figaro gem with Sinatra. I have installed Figaro and it created the following file/ folder...
/config/application.yml
On this file I have added some environment variables...
ENV['GMAIL_USERNAME']
ENV['GMAIL_PASSWORD']
Then on my my "app.rb" file I am trying to include the yml file like...
require 'config/application.yml'
How can I have access to my "ENV['BIG_SECRET']" in my app.rb file?
Mail.defaults do
delivery_method :smtp, {
:address => 'smtp.gmail.com',
:port => '587',
:domain => 'mydomain.com',
:user_name => ENV['GMAIL_USERNAME'],
:password => ENV['GMAIL_PASSWORD'],
:authentication => :plain,
:enable_starttls_auto => true
}
end
You should declare yuor variables in application.yml as explained at Figaro github README https://github.com/laserlemon/figaro (in YAML syntax):
You will be able to access the declared variables as follows: