A very minimal `.env` parser for Deno.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Bauke 6333f861d5
Request read and env permissions if not already granted.
1 month ago
.env Initial commit! 🌠 1 month ago
.env.wrong Initial commit! 🌠 1 month ago
.gitignore Add an example and testing/coverage info. 1 month ago
LICENSE Initial commit! 🌠 1 month ago
README.md Add an example and testing/coverage info. 1 month ago
minimal_dotenv.test.ts Use deno fmt. 1 month ago
minimal_dotenv.ts Request read and env permissions if not already granted. 1 month ago

README.md

minimal_dotenv

A very minimal .env parser for Deno.

Requires --allow-read and --allow-env permissions (for obvious reasons).

Example

import dotenv from "https://deno.land/x/minimal_dotenv/minimal_dotenv.ts";

await dotenv();

// Optionally, you can specify the filename/full path:
// await dotenv(".env.different");

// With .env file containing MINIMAL_DOTENV="working" outputs:
// minimal_dotenv is working
console.log(`minimal_dotenv is ${Deno.env.get("MINIMAL_DOTENV")}`);
Testing & Coverage

To test and generate code coverage (requires LCOV‘s genhtml to output HTML).

# Run the tests and emit coverage data.
deno test --allow-read --allow-env --coverage=.coverage
# Convert Deno's output coverage to LCOV.
deno coverage --lcov .coverage > .coverage/report.lcov
# Convert LCOV to HTML.
genhtml -o .coverage/html .coverage/report.lcov
# Open the coverage in your browser.
firefox .coverage/html/index.html

License

Licensed with the AGPL-3.0-or-later license.