2

I'm creating a new application in Rails 6, and the workflow for keeping secrets in our other Rails apps (anywhere from 4.x and 5.2) was to create an .env file and import them through the dotenv gem, and then have config/secrets pull from the ENV hash.

However, when I run a console session in the R6 app and I try to access ENV, I see an old version where the variables I just added do not appear, while other variables I added last week are there. What's stranger is that if I run rails c -e test, ENV does include the new variables even though .env.test does not include them. (Meanwhile, ENV has all the variables when running through RSpec.)

Does anyone have ideas about this behavior? Should we consider using credentials instead?

EDIT: Well this is embarrassing: I rebooted my Macbook and now the ENV variables are updated.

Lee Wang
  • 46
  • 5

2 Answers2

2

Happened the same to me, annoying. Could this be related to a specific dotenv loading issue? or maybe related to the underlying OS (MacOS 10.15.7 in my case)?

Related issue: https://github.com/bkeepers/dotenv/issues/308

Update: Tried bin/spring stop as suggested here with no success

Ben Orozco
  • 4,361
  • 4
  • 33
  • 49
0

Restarting the system in macOS Ventura 13.1 with an Intel chip worked for me.

David
  • 97
  • 9