Use environment variables in Rake task

怎甘沉沦 提交于 2019-11-30 09:56:41

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!