This example shows how you can set environment variables when running Bazel, then access them inside your program.
--define=some_env=some_value option to Bazel, as shown here in package.jsonsome_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.process.env['some_env'] as usual, shown here in define.spec.js.