ruby-on-railsherokufigaro-ruby

Can I use the figaro gem to set env variables in my local environment?


I use the Figaro gem to set env variables for my apps hosted on Heroku.

To set the required env variables on production I use this:

$ figaro heroku:set -e production

Can I do something similar for my local environment? Right now I'm manually calling export foo=bar for each variable.

Thanks in advance!


Solution

  • Yes. Make sure you have it installed in your Gemfile:

    gem 'figaro'
    bundle install
    

    Then run:

    figaro:install
    

    And it will generate an application.yml file.

    Make sure you use add your environment variables under the respective environments:

    development:
      my_env_var: "stuff"
    test:
      my_env_var: "stuff"