Skip to content

Conversation

@dsherret
Copy link
Member

@dsherret dsherret commented Nov 4, 2025

Adds the ability to ignore certain environment variables and return undefined instead of erroring.

> cat main.ts
console.log(Deno.env.get("VAR1"));
console.log(Deno.env.get("VAR2"));
console.log(Deno.env.toObject());
> VAR1=1 VAR2=2 deno run --ignore-env main.ts
undefined
undefined
[Object: null prototype] {}
> VAR1=1 VAR2=2 deno run --ignore-env=VAR1 --allow-env=VAR2 main.ts
undefined
2
[Object: null prototype] { VAR2: "2" }

Also doesn't error anymore when doing --allow-env --deny-env=SOMETHING and getting all env vars.

Closes #30891
Closes #31071

@bartlomieju
Copy link
Member

Closes #31071?

@dsherret dsherret marked this pull request as ready for review November 5, 2025 16:14
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.

Spefic permission for enumerating environment keys. Permission configuration: Acknowledging a permission being read, but 'ignore' it.

2 participants