> ## Documentation Index
> Fetch the complete documentation index at: https://dify-6c0370d8-docs-new-agent-experience.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 環境変数

> 環境変数で現在の 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 />Windows：`%APPDATA%\difyctl` |
| `DIFY_LIMIT`         | リストコマンド（`get app`、`auth devices list`）のデフォルトのページサイズ（1〜200）。優先順位は `--limit` フラグが先、次にこの変数です。                                                    | `20`                                                                                                    |
| `DIFY_WORKSPACE_ID`  | `difyctl` コマンドの対象となるワークスペース。UUID である必要があります。解決順序は [difyctl がワークスペースを選択する方法](/ja/cli/reference/workspaces#difyctl-がワークスペースを選択する仕組み) を参照してください。 | なし                                                                                                      |
| `DIFYCTL_HTTP_RETRY` | 一時的な障害が発生した際の、冪等なリクエストの再試行回数（`0` で再試行を無効化）。[`--http-retry`](/ja/cli/reference/global-flags#http-リトライ) が上書きします。                                | `3`                                                                                                     |

無効な値は黙って無視されるのではなく、使用法エラー（終了コード `2`）として失敗します。たとえば UUID でない `DIFY_WORKSPACE_ID` です。

<Info>
  `difyctl` の動作を変えるのは上記の変数だけです。`env list` コマンドに表示されるその他の変数は、認識されますが現在は効果がありません。
</Info>

## 設定値を確認

```text theme={null}
difyctl env list [flags]
```

`env list` は、Shell 内の各 `difyctl` 環境変数の現在の値を表示します。ローカル環境のみを読み取り、サーバーを呼び出すことはないため、サインイン前でも使用できます。

### フラグ

| フラグ      | 型       | デフォルト   | 説明                          |
| :------- | :------ | :------ | :-------------------------- |
| `--json` | boolean | `false` | 一覧をテーブルではなく JSON 配列として出力する。 |

<Note>
  `env list` が受け取るのは `--json` であり、[`-o` グローバルフラグ](/ja/cli/reference/global-flags) ではありません。
</Note>

### 例

現在の Shell でどの変数が設定されているかを確認します：

```bash theme={null}
difyctl env list
```

同じ一覧を JSON で取得します：

```bash theme={null}
difyctl env list --json
```

### 出力

未設定の変数は `<unset>` と表示され、機密性の高い変数は値を出力しません（`<set>` または `<unset>` のみ）。`DIFY_LIMIT=50` をエクスポートした場合：

```text theme={null}
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` は変数ごとに 1 エントリの JSON 配列を出力し、上記と同じ方法でマスクします：

```json theme={null}
[
  {
    "name": "DIFY_CONFIG_DIR",
    "description": "Override the config-dir resolution (precedes XDG_CONFIG_HOME on Linux).",
    "sensitive": false,
    "value": "<unset>"
  }
]
```

### 終了コード

| コード | 意味 |
| :-- | :- |
| `0` | 成功 |

完全な体系は [出力フォーマットと終了コード](/ja/cli/reference/output-formats-and-exit-codes) を参照してください。
