Skip to content

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
@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