-
Notifications
You must be signed in to change notification settings - Fork 655
feat(dotenv): add URL as envPath type #6621
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6621 +/- ##
==========================================
- Coverage 94.54% 94.53% -0.01%
==========================================
Files 580 580
Lines 43887 43887
Branches 6501 6501
==========================================
- Hits 41492 41490 -2
- Misses 2352 2354 +2
Partials 43 43 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dotenv/mod_test.ts
Outdated
@@ -29,6 +29,18 @@ Deno.test("load() handles non-existent .env files", async () => { | |||
assertEquals({}, loadSync(loadOptions)); | |||
}); | |||
|
|||
Deno.test("load() handles URL as path for .env files", async () => { | |||
const conf = loadSync({ | |||
envPath: new URL(path.join(testdataDir, ".env"), import.meta.url), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new URL(path.join(testdataDir, ".env"), import.meta.url)
This doesn't work on windows as the paths are \
separated on windows, but that doesn't work as URL string
You need to call toFileUrl
from @std/path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean like this:
new URL(
toFileUrl(path.join(testdataDir, ".env")),
import.meta.url,
)
?
Anything missing @kt3k for this to be merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay in reviewing. This now looks good to me. Thank you for your contribution!
This PR fixes #6620, by adding
URL
as a valid type to theenvPath
parameter in theLoadOptions
interface.