Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
WvanLelyveld opened this issue Aug 22, 2016 · 7 comments
Closed

Comments

@WvanLelyveld
Copy link

WvanLelyveld commented Aug 22, 2016

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.

@BooneTeam
Copy link

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

@mltsy
Copy link

mltsy commented Apr 24, 2017

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?

@sauronnikko
Copy link

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

@matyus
Copy link

matyus commented Nov 26, 2017

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

@neymarsabin
Copy link

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

@jonathanhefner
Copy link
Member

I believe this is a duplicate of #305.

@rafaelfranca
Copy link
Member

Duplicate of #305

@rafaelfranca rafaelfranca marked this as a duplicate of #305 Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants