figaro
figaro copied to clipboard
Spring Upgrade Broke Figaro for Rails Console
When I upgraded to Spring 1.3.3 in an existing app, Figaro broke for the console only.
Meaning, updates to application.yml would not be reflected in ENV. The contents from before the upgrade were somehow cached, even after running reload!
or restarting the console.
I solved the problem by creating a config/initializers/spring.rb
with:
if defined? Spring
Spring.watch "config/application.yml"
end
The inconsistency between the web server (working) and the console (not working) made it difficult for me to diagnose. Maybe someone who has a deeper knowledge of Rails and Figaro can help determine the cause?
+1
+1
If an update to Spring is caused things to break, and this issue persists outside of restarts, I suspect you'll need to open an issue there.
Also, heads up: Steve's a bit of a spring hater.
:+1: +1
What an annoying bug :bomb:
For anyone that is still bothered by this, the issue is that Spring does not watch aplication.yml by default. All you have to do is add this to a spring.rb initializer:
Spring.watch "config/application.yml"
Restart spring and you should be good to go.