spring icon indicating copy to clipboard operation
spring copied to clipboard

Spring doesn't reload when passing ENV vars in the command line

Open WvanLelyveld opened this issue 10 years ago • 7 comments

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.

WvanLelyveld avatar Aug 22 '16 15:08 WvanLelyveld

+1 $ spring stop has become my first thing I do now when things go wrong as it's normally the culprit.

BooneTeam avatar Apr 12 '17 16:04 BooneTeam

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?

mltsy avatar Apr 24 '17 15:04 mltsy

+1 to this. Got this issue and wasted several hours until I read this topic

sauronnikko avatar Aug 22 '17 21:08 sauronnikko

+1, this fixed an issue I was having with loading changes to environment variables, secrets.yml was not updating but spring stop fixed it.

matyus avatar Nov 26 '17 14:11 matyus

I wasted several hours, until someone redirected me here. Still need to do spring stop as a fix.

neymarsabin avatar Jun 20 '18 06:06 neymarsabin

I believe this is a duplicate of #305.

jonathanhefner avatar Apr 11 '20 01:04 jonathanhefner

Duplicate of #305

rafaelfranca avatar Apr 13 '20 20:04 rafaelfranca