Files
dify-docs/zh/cli/reference/environment-variables.mdx
Riskey 2f88f0f7d2 docs: sync Cloud documentation for Dify 1.15.0 (#835)
* docs: add Human Input file inputs and Service API to Cloud docs

Port the Phase 2 Human Input docs (file inputs and the Service API integration flow) to the Cloud docs, mirroring the self-host pages.

- human-input.mdx (en/zh/ja): add the Single File / File List field type and the file-handling notes; the upload-limit callout states Cloud's fixed limits (documents 15 MB, images 10 MB, audio 50 MB, video 100 MB, up to 10 files) instead of self-host env vars.
- hitl-api-integration-flow.mdx (en/zh/ja): new; identical to self-host since the Service API is the same.
- docs.json: nest the integration-flow under the Human Input group in all three navs.
- zh/ja reuse the self-host translations; only the callout and the /self-host/ links changed.

* docs: rewrite Cloud model providers around AI Credits

* docs: rewrite Cloud subscription management for 1.15.0

* docs: update Cloud code node limits and XLSX image extraction note

* docs: rewrite Cloud team members management for 1.15.0

* docs: apply the 1.15.0 Integrations redesign to Cloud docs

* docs: fix workflow API reference for run-level logs and streaming

* docs: sync self-host use-dify pages and fix translation debt

* docs: align shared tutorials and quick start with 1.15.0

* docs: refine difyctl install examples and workspace reference

* docs: rewrite hotkeys page to match current shortcuts

* fix: correct broken anchor links for badged headings and tabs

* fix: correct env link and Human Input resume identifier

* feat: handle heading badges in link-checker slugs

* fix: repoint publish-mcp cross-links to the merged MCP section

* docs: rename plugin dev CLI to Dify Plugin CLI

* docs: refine CLI reference readability and expand --agent

* feat: stop format checkers flagging indented list-item content

* fix: correct zh/ja custom-endpoint spacing and a list blank line

* docs: clarify Cloud model provider install and AI Credits coverage
2026-07-02 19:51:55 +08:00

94 lines
3.6 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 环境变量
description: 通过环境变量为当前 Shell 会话设置 difyctl 的默认值
---
> 本文档由 AI 自动翻译。如有任何不准确之处,请参考 [英文原版](/en/cli/reference/environment-variables)。
环境变量为当前 Shell 会话设置默认值:会话中运行的每条 `difyctl` 命令都会读取它们。优先级上,命令行参数高于环境变量。环境变量的作用域限于当前 Shell,仅在会话期间有效。
## difyctl 读取的变量
| 变量 | 作用 | 默认值 |
|:---|:---|:---|
| `DIFY_CONFIG_DIR` | `difyctl` 存放配置文件(`hosts.yml`)的位置。 | macOS 和 Linux`~/.config/difyctl`Linux 遵循 `XDG_CONFIG_HOME`<br></br><br></br>Windows`%APPDATA%\difyctl` |
| `DIFY_LIMIT` | 列表命令(`get app`、`auth devices list`)的默认页大小,取值 1 到 200。优先级上,`--limit` 参数高于该变量。 | `20` |
| `DIFY_WORKSPACE_ID` | `difyctl` 命令所针对的工作空间,必须为 UUID。解析顺序详见 [difyctl 如何选择工作空间](/zh/cli/reference/workspaces#difyctl-如何选择工作空间)。 | 无 |
| `DIFYCTL_HTTP_RETRY` | 幂等请求遇到瞬时故障时的重试次数(`0` 表示禁用重试)。[`--http-retry`](/zh/cli/reference/global-flags#http-重试) 会覆盖它。 | `3` |
无效的值会作为用法错误失败(退出码 `2`),而不会被静默忽略,例如非 UUID 的 `DIFY_WORKSPACE_ID`。
<Info>
只有上表中的变量会影响 `difyctl` 的行为。`env list` 命令列出的其他变量虽被识别,但目前不起作用。
</Info>
## 查看已设置的变量
```text
difyctl env list [flags]
```
`env list` 显示当前 Shell 中每个 `difyctl` 环境变量的值。它只读取本地环境,从不调用服务器,因此登录前也能使用。
### 标志
| 标志 | 类型 | 默认值 | 说明 |
|:---|:---|:---|:---|
| `--json` | boolean | `false` | 将清单以 JSON 数组而非表格形式输出。 |
<Note>
`env list` 接受的是 `--json`,而非 [`-o` 全局参数](/zh/cli/reference/global-flags)。
</Note>
### 示例
查看当前 Shell 中设置了哪些变量:
```bash
difyctl env list
```
以 JSON 形式获取同一份清单:
```bash
difyctl env list --json
```
### 输出
未设置的变量显示为 `<unset>`,敏感变量从不输出其值(只显示 `<set>` 或 `<unset>`)。当 `DIFY_LIMIT=50` 已导出时:
```text
NAME VALUE DESCRIPTION
DIFY_CONFIG_DIR <unset> Override the config-dir resolution (precedes XDG_CONFIG_HOME on Linux).
DIFY_FORMAT <unset> Default output format for list commands (table | json | yaml | wide | name).
DIFY_HOST <unset> Default Dify host (overridden by --host).
DIFY_LIMIT 50 Default page size for list commands (1..200).
DIFY_NO_PROGRESS <unset> Suppress progress spinners. Truthy values: 1, true, yes.
DIFY_PLAIN <unset> Disable ANSI colors and decorative output. Truthy values: 1, true, yes.
DIFY_TOKEN <unset> Bearer token for non-interactive auth.
DIFY_WORKSPACE_ID <unset> Workspace ID used for difyctl commands.
DIFYCTL_HTTP_RETRY <unset> HTTP retry count for GET/PUT/DELETE. 0 disables. Overrides --http-retry flag.
```
`--json` 输出一个 JSON 数组,每个变量一项,掩码方式与上面相同:
```json
[
{
"name": "DIFY_CONFIG_DIR",
"description": "Override the config-dir resolution (precedes XDG_CONFIG_HOME on Linux).",
"sensitive": false,
"value": "<unset>"
}
]
```
### 退出码
| 退出码 | 含义 |
|:---|:---|
| `0` | 成功 |
完整方案详见 [输出格式与退出码](/zh/cli/reference/output-formats-and-exit-codes)。