Function: sys.get_env

Retrieves the value of the specified environment variable.

If the specified variable is not set, returns the default value instead.

The following built-in environment variables are supported:

Variable name Description
GOOGLE_CLOUD_LOCATION The workflow's location.
GOOGLE_CLOUD_PROJECT_ID The workflow project's identifier.
GOOGLE_CLOUD_PROJECT_NUMBER The workflow project's number.
GOOGLE_CLOUD_SERVICE_ACCOUNT_NAME The workflow execution's service
account name.
GOOGLE_CLOUD_WORKFLOW_EXECUTION_ID The workflow execution's identifier.
GOOGLE_CLOUD_WORKFLOW_ID The workflow's identifier.
GOOGLE_CLOUD_WORKFLOW_REVISION_ID The workflow's revision identifier.

You can also retrieve user-defined environment variables. For more information, see Use environment variables.

Arguments

Arguments
name

string

The requested environment variable name.

default

string

The string value to return if the named variable is not set.

Returns

The value of the named environment variable, or the default if not set.

Raised exceptions

Exceptions
TypeError If either name or default is not a string.

Examples

For more information, see Built-in environment variables

# Retrieve value of specified environment variable
# For example, returns "us-central1"
- returnStep:
    return: ${sys.get_env("GOOGLE_CLOUD_LOCATION")}