Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

When setting safe env access is required #63

Open
oscartbeaumont opened this issue Feb 12, 2022 · 0 comments
Open

When setting safe env access is required #63

oscartbeaumont opened this issue Feb 12, 2022 · 0 comments

Comments

@oscartbeaumont
Copy link

If you try and run the code the following code with the command deno run --allow-read test.ts it succeeds.

import { config } from "https://deno.land/x/dotenv/mod.ts";

console.log(config());

However, if you use the same command but run the following code it crashes with the error also included below.

import { config } from "https://deno.land/x/dotenv/mod.ts";

console.log(config({ safe: true }));
error: Uncaught PermissionDenied: Requires env access to all, run again with the --allow-env flag
    at Object.opSync (deno:core/01_core.js:149:12)
    at Object.toObject (deno:runtime/js/30_os.js:81:19)
    at assertSafe (https://deno.land/x/dotenv@v3.2.0/mod.ts:174:31)
    at processConfig (https://deno.land/x/dotenv@v3.2.0/mod.ts:114:5)
    at config (https://deno.land/x/dotenv@v3.2.0/mod.ts:63:10)
    at file:///[REDACTED]/test.ts:3:13

I don't understand why the inclusion of the safe parameter would require environment variable access. I am building a small webserver and would prefer to only load environment variables from disk and not allow direct environment variable access to Deno.

Thanks for this awesome module!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant