Support for loading .env in a different directory #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
About five minutes after submitting issue #2 I worked out a solution! This should fix both #2 and #1.
This changes the recommended plugin usage from:
To:
I'd prefer not to have to do that, but I can't work out how to get the path to the Vagrantfile. (Maybe someone with better knowledge of Vagrant internals can fix that...) In the mean time, the original method (with no parameters) will still work and still have the same effect it used to - looking in the current working directory instead of the Vagrantfile directory.
I also added three low-level methods to allow the user to call Dotenv methods directly:
See the dotenv source comments for explanations of these three methods. (They don't seem to be documented anywhere else...) Note that these paths are relative to the current working directory, so
File.dirname(__FILE__)may be called for here.