Ever have an issue getting environment variables to load when running Rails Console via foreman? US TOO! For instance, we store all of our database info in .env files. If I simply ran "foreman rails s" the environment vars worked like a charm. However, the exact same vars wouldn't load when running "foreman run rails c". I kept trying to run basic rails commands and kept getting weird MySQL errors:
I beat my head against the wall for a few minutes until I found the solution on this github thread. The fix (at least for us) is to stop spring ("spring stop"). Doing this allowed me to access environment vars in the console via foreman.