Skip to content
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

feat: allow setting environment variables and disable extending in DenoServer #82

Merged
merged 11 commits into from
Aug 9, 2022

Conversation

danez
Copy link
Contributor

@danez danez commented Aug 1, 2022

This is a prerequisite for netlify/cli#4614.

The PR allows setting environment variables in deno.run and deno.runInBackground as well as disabling extending of current runtime environment variables. These two options basically are plain execa options, which are forwarded to execa.

I disabled the extending of env variables in the DenoServer so that once the CLI sets the variables it will be only those available in deno. With the exception of DENO_DIR. DENO_DIR is okay to have locally?

@danez danez added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Aug 1, 2022
@danez danez requested a review from a team August 1, 2022 16:56
@danez danez marked this pull request as draft August 1, 2022 17:01
@danez danez marked this pull request as ready for review August 2, 2022 11:32
@danez
Copy link
Contributor Author

danez commented Aug 4, 2022

Okay I finally managed to add some tests. This is ready to review.

@@ -31,6 +31,8 @@ interface ProcessRef {

interface RunOptions {
pipeOutput?: boolean
env?: NodeJS.ProcessEnv
extendEnv?: boolean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what case would we set extendEnv to true? Or is this for backwards compatibility?

Copy link
Contributor Author

@danez danez Aug 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value is true atm. I was hardcoding this at first, but then wondered if runInBackground might be used in other scenarios in the future. Do you think I should hardcode this to false?
And because run does the same, besides the background part I also added the options there.

@danez danez requested review from a team and Skn0tt August 8, 2022 10:23
eduardoboucas
eduardoboucas previously approved these changes Aug 8, 2022
test/bridge.ts Outdated Show resolved Hide resolved
Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com>
eduardoboucas
eduardoboucas previously approved these changes Aug 8, 2022
src/server/server.ts Show resolved Hide resolved
Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com>
@danez danez added the automerge label Aug 9, 2022
@kodiakhq kodiakhq bot merged commit 3b9af3d into main Aug 9, 2022
@danez danez deleted the environment branch October 24, 2022 09:22
Skn0tt pushed a commit to netlify/build that referenced this pull request Apr 23, 2024
…noServer (netlify/edge-bundler#82)

* feat: allow setting environment variables and disable extending in DenoServer

* chore: fix test

* chore: fix tests

* chore: add test

* chore: debug

* chore: fix tests

* chore: fix tests?

* Update test/bridge.ts

Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com>

* Update src/server/server.ts

Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com>

Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants