Question about Dotenv.load
coding-bunny opened this issue · comments
Arne De Herdt commented
If I use Dotenv.load in a plain Ruby app, will it also load automatically other files if I have them defined and the RAILS_ENV variable set? Or do I need to manually load them?
Yves Siegrist commented
Short answer: you have to manually load them.
Long answer:
If you want the rails behaviour, you would have to do require 'dotenv/rails'
which would not work or just raise an exception unless you're using rails. The reason for this is that dotenv hooks itself into the rails plugin pipeline.
Arne De Herdt commented
Okay, then I did it right!
We copied the logic of the rails loader and just load them ourselves in the correct order.
Thanks for the clarification.