Skip to content

Latest commit

 

History

History
 
 

define_var

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Defining environment variables

This example shows how you can set environment variables when running Bazel, then access them inside your program.

  1. Use the --define=some_env=some_value option to Bazel, as shown here in package.json
  2. Bazel is hermetic, so if you want some_env to be exposed into the environment of an action, it must be declared, using configuration_env_vars = ["some_env"] as shown here in BUILD.bazel.
  3. In your Node.js program, reference process.env['some_env'] as usual, shown here in define.spec.js.