Skip to content

[env] Add --env and --env-file flags #1353

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

Merged
merged 2 commits into from
Aug 9, 2023
Merged

[env] Add --env and --env-file flags #1353

merged 2 commits into from
Aug 9, 2023

Conversation

mikeland73
Copy link
Contributor

Summary

Adds --env and --env-file flags that can be used with run shell and services

If both flags are specified they are merged with --env taking precedence.

environment variables passed in with flags take the highest level of precedence, replacing any env variables set by nix, devbox.json, or plugins.

TODO: The flag code is a bit brittle and repetitive, I think we can consolidate the common flag registration.

How was it tested?

devbox run -e FOO=BAR echo \$FOO
devbox services up -e HTTPD_PORT=8083

Copy link
Collaborator

@mohsenari mohsenari left a comment

Choose a reason for hiding this comment

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

We should add in our docs that if both env and env-file are specified env takes priority

@mikeland73 mikeland73 merged commit c663ddc into main Aug 9, 2023
@mikeland73 mikeland73 deleted the landau/env branch August 9, 2023 00:37
@Lagoja
Copy link
Contributor

Lagoja commented Aug 9, 2023

Should also help with #1215, since we can set the NIX_HARDENING_ENABLE variable with the -e flag

@sentry-io
Copy link

sentry-io bot commented Aug 16, 2023

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ **syscall.Errno: error running command in Devbox: <redacted errors.withStack>: <redacted fs.PathError>: <redacte... go.jetpack.io/devbox/internal/impl in (*Devbox)... View Issue
  • ‼️ **syscall.Errno: <redacted errors.withStack>: <redacted fs.PathError>: go.jetpack.io/devbox/internal/boxcli in (*envFl... View Issue

Did you find this useful? React with a 👍 or 👎

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

Successfully merging this pull request may close these issues.

3 participants