variables Command - Medusa Cloud CLI Reference
In this guide, you'll learn how to inspect the environment variables of a Cloud environment using the CLI.
variables list#
List all environment variables for a Cloud environment.
Options#
Option | Description | Required | Default |
|---|---|---|---|
| The ID of the organization that the environment belongs to. | Yes | Falls back to the organization in the active context, if set. |
| The ID or handle of the project that the environment belongs to. | Yes | Falls back to the project in the active context, if set. |
| The handle of the environment to list variables from. | Yes | Falls back to the environment in the active context, if set. |
| Print secret values in plain text instead of masking them. | No |
|
| Maximum number of variables to return. Minimum: | No |
|
| Pagination offset. | No |
|
| Print the result as JSON instead of formatted text. | No |
|
variables get#
Retrieve a single variable by its ID (var_...) or by its key. Looking up by key requires --project and --environment (or the equivalent values in the active context) so the CLI knows which environment to search.
You can also fetch a variable by ID without setting the active environment:
This returns the variable's details, similar to the following:
Arguments#
Option | Description | Required |
|---|---|---|
| Variable ID ( | Yes |
Options#
Option | Description | Required | Default |
|---|---|---|---|
| The ID of the organization that the variable belongs to. | Yes | Falls back to the organization in the active context, if set. |
| The ID or handle of the project that the variable belongs to. Required when looking up by key. | Conditional | Falls back to the project in the active context, if set. |
| The handle of the environment that the variable belongs to. Required when looking up by key. | Conditional | Falls back to the environment in the active context, if set. |
| Print the secret value in plain text instead of masking it. | No |
|
| Print the result as JSON instead of formatted text. | No |
|
Reveal Secret Values#
By default, the CLI masks values for variables marked as secrets. Pass --reveal to print the plaintext value:
--reveal on shared terminals or in shell history. The plaintext value is printed to standard output, which is captured by terminal scrollback, log aggregators, and process listings.Export Variables to a .env File#
Use --json and jq to extract variables and write them to a local .env file. This is useful for replicating a Cloud environment's variables to a local development environment: