Skip to content

Instantly share code, notes, and snippets.

@andxyz
Last active February 11, 2016 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andxyz/37b08c26db922d85a808 to your computer and use it in GitHub Desktop.
Save andxyz/37b08c26db922d85a808 to your computer and use it in GitHub Desktop.

Here is a sample application.yml note figaro expects every key value pair to have a string as the value.

# application.yml
development:
  TWILIO_ACCOUNT_SID: 'AC1234…'
  TWILIO_AUTH_TOKEN: 'abc12…'

test:
  TWILIO_ACCOUNT_SID: 'AC5678…'
  TWILIO_AUTH_TOKEN: 'abc34…'

Some sample code for figaro_test.rb

require 'figaro'

ENV['FIGARO_ENVIRONMENT'] = "#{ENV['RACK_ENV']}" || 'development'

Figaro.application = Figaro::Application.new(environment: ENV['FIGARO_ENVIRONMENT'], path: 'config/application.yml')

Figaro.load

Figaro.require_keys('TWILIO_ACCOUNT_SID')

puts Figaro.env.TWILIO_ACCOUNT_SID!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment