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

Raise if using an unsupported Rails version #485

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bkeepers
Copy link
Owner

Requested by @Earlopain in #481 (comment).

This will raise an error for people using just the dotenv gem with an unsupported Rails version. Those using dotenv-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 call Dotenv.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.

@Earlopain
Copy link

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.

initializer "dotenv", after: :initialize_logger do |app|
# Set up a new logger once Rails has initialized the logger and replay logs

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.

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

Successfully merging this pull request may close these issues.

None yet

2 participants