# Get environment variable with default valueapi_key = env.get("API_KEY", "default-key")print(api_key)# Get required environment variabledatabase_url = env.get("DATABASE_URL")if not database_url: fail("DATABASE_URL environment variable is required")
# env is a Starlark module that provides functions for getting and setting # environment variables on the host machine.# make_env returns a struct with get and set methods# that can be used to get and set environment variablesdef make_env(): def get(key, default=None): """ Returns the value of the environment variable `key`. Args: key: The name of the environment variable. default: The default value to return if the environment variable is not set. """ pass return struct( get = get, )# env is the importable structenv = make_env()