mcloud-variables
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCloud CLI: Variables Commands
Cloud CLI: 变量命令
Execute commands to inspect environment variables for Cloud environments.
mcloud variables执行命令,检查云环境的环境变量。
mcloud variablesConstraints
约束条件
- Never pass unless the user explicitly asks. Secret values appear in terminal scrollback, log aggregators, and process listings.
--reveal - Looking up by key requires and
--project(or the equivalent in active context). Looking up by ID (--environment) works without project/environment context.var_...
- 除非用户明确要求,否则请勿使用参数。 敏感值会出现在终端回滚记录、日志聚合器和进程列表中。
--reveal - 通过键查询时需要和
--project参数(或使用当前上下文的对应值)。通过ID(格式为--environment)查询时无需项目/环境上下文。var_...
Commands
命令
variables list
variables list
List all environment variables for a Cloud environment.
bash
mcloud variables list \
--organization <org-id> \
--project <project-id-or-handle> \
--environment <environment-handle> \
--jsonOptions:
- — Organization ID (falls back to active context)
-o/--organization <id> - — Project ID or handle (falls back to active context)
-p/--project <id-or-handle> - — Environment handle (falls back to active context)
-e/--environment <handle> - — Print secret values in plaintext instead of masking (use only when explicitly asked)
--reveal - — Max results (default:
--limit <1-500>)200 - — Pagination offset (default:
--offset <number>)0 - — Output as JSON
--json
列出云环境的所有环境变量。
bash
mcloud variables list \
--organization <org-id> \
--project <project-id-or-handle> \
--environment <environment-handle> \
--json选项:
- — 组织ID(若未指定则使用当前上下文的组织)
-o/--organization <id> - — 项目ID或标识(若未指定则使用当前上下文的项目)
-p/--project <id-or-handle> - — 环境标识(若未指定则使用当前上下文的环境)
-e/--environment <handle> - — 以明文形式打印敏感值而非掩码(仅在用户明确要求时使用)
--reveal - — 最大结果数(默认值:
--limit <1-500>)200 - — 分页偏移量(默认值:
--offset <number>)0 - — 以JSON格式输出
--json
variables get
variables get
Retrieve a single variable by its ID () or key.
var_...bash
undefined通过变量ID(格式为)或键获取单个变量。
var_...bash
undefinedBy key (requires project + environment context)
By key (requires project + environment context)
mcloud variables get ADMIN_CORS
--organization <org-id>
--project <project-id-or-handle>
--environment <environment-handle>
--json
--organization <org-id>
--project <project-id-or-handle>
--environment <environment-handle>
--json
mcloud variables get ADMIN_CORS
--organization <org-id>
--project <project-id-or-handle>
--environment <environment-handle>
--json
--organization <org-id>
--project <project-id-or-handle>
--environment <environment-handle>
--json
By ID (works without project/environment context)
By ID (works without project/environment context)
mcloud variables get var_01XYZ --json
**Arguments:**
- `variable` — Variable ID (`var_...`) or key (required)
**Options:**
- `-o/--organization <id>`, `-p/--project <id-or-handle>`, `-e/--environment <handle>`
- `--reveal` — Print secret value in plaintext (**use only when explicitly asked**)
- `--json` — Output as JSONmcloud variables get var_01XYZ --json
**参数:**
- `variable` — 变量ID(格式为`var_...`)或键(必填)
**选项:**
- `-o/--organization <id>`、`-p/--project <id-or-handle>`、`-e/--environment <handle>`
- `--reveal` — 以明文形式打印敏感值(**仅在用户明确要求时使用**)
- `--json` — 以JSON格式输出Variable Fields (JSON)
变量字段(JSON格式)
| Field | Description |
|---|---|
| Variable ID ( |
| Variable name (e.g. |
| Variable value (masked if |
| Whether the variable is treated as a secret |
| Available at build time |
| Available at runtime |
| The environment ID this variable belongs to |
| 字段 | 描述 |
|---|---|
| 变量ID(格式为 |
| 变量名称(例如 |
| 变量值(若 |
| 该变量是否被视为敏感值 |
| 是否在构建阶段可用 |
| 是否在运行阶段可用 |
| 该变量所属的环境ID |
Examples
示例
bash
undefinedbash
undefinedList all variables for the active environment
List all variables for the active environment
mcloud variables list --json
mcloud variables list --json
Get a variable by key (with active context)
Get a variable by key (with active context)
mcloud variables get DATABASE_URL --json
mcloud variables get DATABASE_URL --json
Get a variable by ID (no env context needed)
Get a variable by ID (no env context needed)
mcloud variables get var_01XYZ --json
mcloud variables get var_01XYZ --json
Only reveal secrets when user explicitly asks
Only reveal secrets when user explicitly asks
mcloud variables get STRIPE_SECRET_KEY --reveal --json | jq -r '.value'
mcloud variables get STRIPE_SECRET_KEY --reveal --json | jq -r '.value'
Export all variables to a .env file (user must explicitly request --reveal)
Export all variables to a .env file (user must explicitly request --reveal)
mcloud variables list --reveal --json
| jq -r '.[] | "(.key)=(.value)"' \
| jq -r '.[] | "(.key)=(.value)"' \
.env
mcloud variables list --reveal --json
| jq -r '.[] | "(.key)=(.value)"' \
| jq -r '.[] | "(.key)=(.value)"' \
.env
List only runtime variables
List only runtime variables
mcloud variables list --json | jq '[.[] | select(.is_runtime == true)]'
mcloud variables list --json | jq '[.[] | select(.is_runtime == true)]'
Check if a specific variable exists
Check if a specific variable exists
mcloud variables list --json | jq '.[] | select(.key == "REDIS_URL")'
undefinedmcloud variables list --json | jq '.[] | select(.key == "REDIS_URL")'
undefined