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

Add env option for environment variables to rules #2497

Closed
elado opened this issue Mar 3, 2021 · 0 comments · Fixed by #2499
Closed

Add env option for environment variables to rules #2497

elado opened this issue Mar 3, 2021 · 0 comments · Fixed by #2499
Assignees

Comments

@elado
Copy link

elado commented Mar 3, 2021

🚀 feature request - Add env for environment variables setting per rule

Relevant Rules

  • nodejs_binary
  • nodejs_test
  • npm_package_bin

Description

Add env array to the rules so it's possible to set env vars.

Describe the solution you'd like

Example

load("@npm//jest:index.bzl", "jest_test")

jest_test(
  name = "jest",
  env = ["TZ=UTC"],
  ...
)

or

load("@npm//webpack:index.bzl", "webpack")

webpack(
  name = "jest",
  env = ["ENABLE_SOURCEMAPS=true", "ANOTHER_KEY=value"],
  ...
)

Describe alternatives you've considered

It's possible to add configuration_env_vars and --define in .bazelrc, however .bazelrc affects the entire repo, and it's not possible to use different env vars per rule.

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

Successfully merging a pull request may close this issue.

2 participants