Spring doesn't reload when passing ENV vars in the command line
In Rails 5, when I start rails console with an ENV var i.e. another DATABASE_URL (like DATABASE_URL=postgres://... rails c) , this is not picked up by spring and therefore ignored.
After typing spring stop the ENVs are picked up and the ENVs are taken into consideration.
This is pretty dangerous when choosing another database or rails env. Before rails 5 this worked as expected.
+1
$ spring stop has become my first thing I do now when things go wrong as it's normally the culprit.
I was just going to enter a new issue, but I believe this is probably the same issue I'm having: even when I export an environment variable, and run rails c (specifically to update something embedded as ERB in secrets.yml), Spring doesn't notice the change, and keeps Rails.application.secrets as the original cached, default version (before the env var was set).
It seems as if Spring just doesn't notice new environment variables in parsing YAML files with ERB in them?
+1 to this. Got this issue and wasted several hours until I read this topic
+1, this fixed an issue I was having with loading changes to environment variables, secrets.yml was not updating but spring stop fixed it.
I wasted several hours, until someone redirected me here. Still need to do spring stop as a fix.
I believe this is a duplicate of #305.
Duplicate of #305