You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to the issue described here, I've got some setup in my config/initializers that depend on environment settings. These are loaded from my .env file via foreman. I start up a rails console with foreman run rails c.
In config/spring.rb, I have:
Spring.watch'.env'
Watching spring's log, I can see that any time I change .env, the app re-forks:
[application:development] running -> watcher_stale
[application:development] watcher_stale -> exiting
[application_manager:development] child 22272 shutdown
[application:development] preloading app
At this point, when I run foreman run rails c again, I can access the changes in ENV[...]. However, the config/initializers files are not re-run with the ENV updates, so the old app settings persist.
Is there perhaps a way to force spring to shut down when certain files are changed? Since spring gets started automatically for me, I'm guessing the easiest way to get my changed settings into spring via foreman is with a complete kill and restart of spring.
Perhaps something like Spring.watch('.env', action: :shutdown)?