Environment variables reference for the Compute platform

IMPORTANT: The content on this page uses the following versions of Compute SDKs: JavaScript SDK: 3.1.1 (current is 3.11.0, see changes), Rust SDK: 0.9.1 (current is 0.9.11, see changes), Go SDK: 0.1.2 (current is 1.3.0, see changes)

Compute services can access environment variables provided by the system. All environment variables are strings, though if a variable does not exist, the SDK will behave appropriately. For example, Rust's std::env::var will return a Result(Err).

Reading and setting environment variables

The values of environment variables are set when a Compute instance starts running, and do not change during execution. However, environment variables are writable, and will retain any change written to them through the end of the instance lifecycle. Environment variables are scoped to the instance and are destroyed when the instance ends.

  1. Rust
  2. JavaScript
  3. Go

Environment variables in non-production environments

For more information on the availability and values of environment variables in non-production environment, see Testing and debugging.