Two good ways to do it:
Use Heroku's "Foreman" tool. Put all your environment variables into .env
:
VAR=value
and run foreman run rake some_task
.
Or (and, I'd recommend this way), using the "Figaro" gem. Put your vars into config/application.yml
:
VAR: value
and that's it; rake some_task
.
I'd recommend the latter, if only because rake figaro:heroku
will push your env up as it's specified in application.yml