3

I've been using the Heroku Toolbelt's "Heroku local" command in order to load environmental variables locally. However, this breaks byebug. I am not able to get to a (byebug) prompt when using the Heroku local command. As a result, I'm forced to quit Heroku local and run my server with "rails s." This is a problem however, as my environmental variables are no longer loading.

Heroku Local Documentation: https://devcenter.heroku.com/articles/heroku-local Byebug Documentation: https://github.com/deivid-rodriguez/byebug Overview of loading Env Variables: http://www.gotealeaf.com/blog/managing-environment-configuration-variables-in-rails

miken32
  • 42,008
  • 16
  • 111
  • 154
woodenfox
  • 324
  • 2
  • 14

1 Answers1

1

Install the dotenv-rails gem which loads environmental variables perfectly without the issues above. Simply stop using Heroku local and run your server with "rails s" in order to load environmental variables.

You will no longer load your Procfile as a part of running your server with this approach.

woodenfox
  • 324
  • 2
  • 14
  • Was this the only solution you found? Running rails -s is not the same as running it through the heroku toolbelt since the latter runs it through puma (which allows for extended functionality like using httpS which webrick does not support AFAIK) – Gustavo Rubio Nov 12 '15 at 07:09
  • Nevermind, puma gets loaded up with rails s if its installed instead of webrick – Gustavo Rubio Nov 12 '15 at 07:21
  • I prefer to use `direnv` http://direnv.net/ which is a shell level environment switcher. This lets me switch between `heroku local web` and `rails s` as needed. Another plus of `rails s` for debugging is that the shell integration of https://github.com/charliesome/better_errors gem doesn't timeout like it does with `heroku local` – Chris Beck Jun 22 '16 at 23:27
  • `direnv` is also ideal for spring binstubs per https://github.com/rails/spring#setup – Chris Beck Jun 22 '16 at 23:28