envkey
envkey copied to clipboard
Environment variable not removed from Rails (with Spring preloader) when renamed in EnvKey
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!
Thanks @ndbroadbent will have a look at this!