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

Add Spring.reset_on_env #704

Merged
merged 1 commit into from
Dec 15, 2023
Merged

Add Spring.reset_on_env #704

merged 1 commit into from
Dec 15, 2023

Conversation

gmcgibbon
Copy link
Member

@gmcgibbon gmcgibbon commented Nov 22, 2023

Closes #420

Spring needs to restart when certain important environment variables change (eg. DATABASE_URL). Without this, comamnds connect to a stale application instance that has been booted with incorrect config.

Configuration must be set in config/spring_client.rb:

Spring.reset_on_env << "SOME_ENV"

So it can be used like this:

> export SOME_ENV=1 # exports env
> bin/rails runner "" # start server
> SOME_ENV=2 bin/rails runner "" # restarts server

Spring needs to restart when certain important environment variables
change (eg. DATABASE_URL). Without this, comamnds connect to a stale
application instance that has been booted with incorrect config.

Configuration must be set in config/spring_client.rb.
@gmcgibbon gmcgibbon merged commit 28715d7 into rails:main Dec 15, 2023
17 of 18 checks passed
@gmcgibbon gmcgibbon deleted the reset_on_env branch December 15, 2023 05:41
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

Successfully merging this pull request may close these issues.

Need a way to restart server on important environment variable changes
1 participant