Open bkeepers opened 9 months ago
Ok, I see. I haven't thought about the automatic requiring that happens now.
Would it be possible to instead delay this error to time of use? I don't know the places where this could be happening, but the initializer seems run at some point and will pose trouble on Rails < 6.1. https://github.com/bkeepers/dotenv/blob/09caa4d08403770bf70bdd9f4b2404ea99e5312f/lib/dotenv/rails.rb#L96-L97
Does that make sense? Or perhaps just at self.load
. I'm not certain on the order of execution here and in what ways things can happen.
Requested by @Earlopain in https://github.com/bkeepers/dotenv/pull/481#issuecomment-1945621945.
This will raise an error for people using just the
dotenv
gem with an unsupported Rails version. Those usingdotenv-rails
with an old Rails version will properly resolve to dotenv 2.x. The problem is that this will raise an error for those using dotenv in more advance ways (e.g. they could still callDotenv.load
manually and that would be completely fine).I'm not convinced that this is the right thing to do, so I think I'm going to let this sit for now. If anyone has thoughts one way or the other, please share them.