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

Environment variable not removed from Rails (with Spring preloader) when renamed in EnvKey #17

Open
ndbroadbent opened this issue May 16, 2022 · 1 comment

Comments

@ndbroadbent
Copy link

Hello, I just noticed a minor issue during development, but it could cause confusion when using an env var as a feature flag, etc.

Steps to reproduce:

  • Create an new variable in EnvKey under the dev environment, e.g. ENVKEY_WORKING=yes
  • Stop Spring if running (spring stop)
  • Start the Rails console
  • Check the var: puts ENV['ENVKEY_WORKING'] # => yes
  • Rename the variable in Envkey to ENVKEY_RUNNING
  • Restart the Rails console (with Spring)
  • Check the new var: puts ENV['ENVKEY_RUNNING'] # => yes
  • Check the old var: puts ENV['ENVKEY_WORKING'] # => yes

I would expect that the old ENVKEY_WORKING var would be removed. I can see how that would be tricky with the Spring preloader, but maybe you could store a list of variables that were set, and then compare that against the new list when the Rails process restarts, and remove any deleted ones from ENV.

Just a small issue but thought I should mention it! Cheers!

@danenania danenania transferred this issue from envkey/envkey-ruby May 16, 2022
@danenania
Copy link
Contributor

Thanks @ndbroadbent will have a look at this!

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

2 participants