> For the complete documentation index, see [llms.txt](https://manual.dxable.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.dxable.com/1password/inject.md).

# inject

シークレット参照でテンプレート化されたファイルにシークレットを挿入します。

```
op inject [flags]
```

#### **Flags** <a href="#go875tnsr34r" id="go875tnsr34r"></a>

```
    --file-mode filemode   Set filemode for the output file. It is ignored without the --out-file flag. (default 0600)
-f, --force                Do not prompt for confirmation.
-i, --in-file string       The filename of a template file to inject.
-o, --out-file string      Write the injected template to a file instead of stdout.
```

[秘密の参照について詳しく紹介します。](https://developer.1password.com/docs/cli/secret-references)

シークレット参照でテンプレート化された構成ファイルを渡し、実際のシークレットが置き換えられた構成ファイルを受け取ることができます。解決されたファイルは不要になったら必ず削除してください。

[シークレットを構成ファイルに読み込む方法について詳しく紹介します。](https://developer.1password.com/docs/cli/secrets-config-files)

#### [**例**](https://developer.1password.com/docs/cli/reference/commands/inject/#examples) <a href="#p0uuw3ok0l3p" id="p0uuw3ok0l3p"></a>

```
echo "db_password: {{ op://app-prod/db/password }}" | op inject
db_password: fX6nWkhANeyGE27SQGhYQ
```

設定テンプレート ファイルにシークレットを挿入します。

```
cat config.yml.tpl
db_password: {{ op://app-prod/db/password }}
```

```
op inject -i config.yml.tpl -o config.yml && cat config.yml
db_password: fX6nWkhANeyGE27SQGhYQ
```

複数のシークレットを連結できます:

```
echo "db_url: postgres://{{ op://lcl/db/user }}:{{ op://lcl/db/pw }}@{{ op://lcl/db/host }}:{{ op://lcl/db/port }}/{{ op://my-app-prd/db/db }}" | op inject
db_url: postgres://admin:admin@127.0.0.1:5432/my-app"
```

シークレット参照内の変数を使用して、さまざまな環境のさまざまなシークレット セットを切り替えます。

```
echo "db_password: op://$env/db/password" | env=prod op inject
db_password: fX6nWkhANeyGE27SQGhYQ
```


---

# 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:

```
GET https://manual.dxable.com/1password/inject.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
