> For the complete documentation index, see [llms.txt](https://docs-embed.anyflow.jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-embed.anyflow.jp/release/deploy-environment.md).

# デプロイ環境

## 概要

デプロイ環境とは、Anyflow Embed で構築したソリューションをどの環境にデプロイするかを選択できる機能です。

ソリューションをデプロイする際、自社プロダクトの環境が本番・ステージング・開発など複数ある場合は、\
デプロイ環境の機能を使うと**環境ごとに分けてソリューションをデプロイする運用**ができます。

{% hint style="success" %}
ウィザードホスティングの場合も、URLにenvパラメータを付与してアクセスすることでデプロイ環境を切り替えることができます。[こちら](/release/wizard-hosting.md#wizdohosutingudedepuroiwou)を参考にご利用ください。
{% endhint %}

例えば、\
開発途中のソリューションを一度「開発環境」にデプロイして確認を行い、\
問題なければ「ステージング環境」や「本番環境」にもデプロイするなどの運用が可能です。

<figure><img src="https://files.readme.io/7370a0d-image.png" alt="" width="375"><figcaption></figcaption></figure>

また[環境変数](/release/deploy-environment.md#depuroino)を設定することで、環境ごとにコネクタの接続先などを変更することも可能です。\
例えば、\
開発環境のコネクタ： `テスト環境` に接続（ベースURLがテスト環境になっている）\
本番環境のコネクタ： `本番環境` に接続（ベースURLが本番環境になっている）

<figure><img src="https://files.readme.io/22d50af-deploy-environments3.jpg" alt="1652" width="600"><figcaption><p>Anyflow Embedソリューション、デプロイ、デプロイ環境の関係</p></figcaption></figure>

{% hint style="warning" %}

### ご注意ください

Anyflow Embed の管理画面やソリューション実行環境等は全て**本番環境**です。

この「デプロイ環境」の機能は、Anyflow Embedの本番環境の中に**仮想的なパーテーション**を設けることで\
任意のデプロイ先を作成する機能となります。
{% endhint %}

## デプロイ環境ごとに区分されるもの

デプロイ環境ごとに区分されるものは以下の通りです

* 環境の名前
* 環境にデプロイするソリューションや、そのバージョン
* 各環境でエンドユーザーが認証や入力を行った内容（[ソリューションインスタンス](/introduction/glossary.md#soryshoninsutansu)）
* JWTの検証などに用いる[公開鍵](/release/embed/generate-jwt.md#wosuru-1)
* コネクタに定義された[環境変数](#environment-variables)の値

## デプロイ環境の設定方法

<figure><img src="https://files.readme.io/6b56c57-image.png" alt="デプロイ環境の設定画面"><figcaption><p>デプロイ環境の設定画面</p></figcaption></figure>

Anyflow Embedの左メニューから「デプロイ環境」の画面を開きます。

新規作成から、`ユニーク名`, `ディスプレイ名`, `公開鍵`を設定します。

公開鍵の作成については[こちら](/release/embed/generate-jwt.md#wosuru-1)をご確認ください。

補足：

* JWTのissの値は各環境で同一となるため従来から利用している値を利用してください。
* サイトオリジンURLが追加になる場合はAnyflow CSチームにご共有ください。

## 環境変数の設定方法 <a href="#environment-variables" id="environment-variables"></a>

環境変数を設定すると、環境ごとにコネクタの接続先を変更することが可能です。

例えば「奉行クラウド」との連携に際し、以下の様に接続先を変更できます。\
デプロイ環境名が「開発環境」の 奉行クラウドコネクタ ： 奉行クラウド の デモ環境 に接続\
デプロイ環境名が「本番環境」の 奉行クラウドコネクタ ： 奉行クラウド の 本番環境 に接続

<figure><img src="https://files.readme.io/3ff15b6-image.png" alt="環境変数の設定フィールド" width="563"><figcaption><p>環境変数の設定フィールド</p></figcaption></figure>

環境変数を利用する場合は、以下の手順で行います。

* （ベンダー）設定したい環境変数の内容を**Anyflow CSチームに連絡**
* （Anyflow）環境変数の追加対応・完了連絡
* （ベンダー）デプロイ環境の編集画面で環境変数を編集・保存

{% hint style="warning" %}

### 注意

現時点では、Anyflowの標準コネクタに環境変数を設定することはできません。\
環境変数を設定できるのは外部SaaSとの連携コネクタのみです。
{% endhint %}

## 使い方

### テスト実行時の環境選択

ソリューションをテストする際に、デプロイ環境を選択してテストすることが可能です。\
デプロイ環境を作成していなければ、通常のテスト画面となります。

<figure><img src="https://files.readme.io/b9df8d0-deploy-environments1.png" alt="1440"><figcaption><p>デプロイ環境の選択画面</p></figcaption></figure>

### デプロイ時の環境選択

デプロイをする際に、デプロイ環境を選択してデプロイすることが可能です。\
デプロイ環境を作成していなければ、通常のデプロイ画面となります。

<figure><img src="https://files.readme.io/a4b349a-deploy-environments2.png" alt="2880"><figcaption><p>デプロイ環境の選択画面</p></figcaption></figure>

### デプロイ環境ごとの処理分岐

[標準変数](/solution-editor/variables/standard.md)の「デプロイ環境のユニーク名」を使うことで、デプロイ環境ごとに処理を変えることができます。

<figure><img src="https://files.readme.io/b16c149ca1dd4a067455fd129263ebfbcf6e783b281d2690f6ceb432d7be98d1-image.png" alt="" width="375"><figcaption></figcaption></figure>

### ウィザードホスティングの場合

ウィザードホスティングでデプロイ環境を使う場合は、ウィザードホスティングのURLにパラメータを付与して環境を指定します。詳しくは[こちら](/release/wizard-hosting.md#depuroiwou)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-embed.anyflow.jp/release/deploy-environment.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
