Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

docs(cli): add note about --recursive (#7832)

Adrian Kahali0ebb30b7a126
diff --git a/docs/cli/commands/run.mdx b/docs/cli/commands/run.mdx
index d541d05240..9de387459a 100644
--- a/docs/cli/commands/run.mdx
+++ b/docs/cli/commands/run.mdx
@@ -182,6 +182,25 @@ infisical run -- npm run dev
</Accordion>
+ <Accordion title="--recursive">
+ By default, `infisical run` only injects the secrets that sit directly in `--path` (the root of the environment, `/`, unless you set it). Secrets inside folders are left out. Add `--recursive` to also inject the secrets in every subfolder of `--path`.
+
+ If your secrets sit in one folder, `--path` alone is enough. Use `--recursive` when that folder has subfolders you also need.
+
+ ```bash
+ # Example - every secret under /backend and its subfolders
+ infisical run --path="/backend" --recursive -- npm run dev
+
+ # Example - every secret in the environment, from every folder
+ infisical run --recursive -- npm run dev
+ ```
+
+ Since `--recursive` widens what gets injected, scope it with `--path` so your application only receives the secrets it needs.
+
+ Default value: `false`
+
+ </Accordion>
+
</Accordion>
diff --git a/docs/cli/commands/secrets.mdx b/docs/cli/commands/secrets.mdx
index 164f92e14d..992dc17893 100644
--- a/docs/cli/commands/secrets.mdx
+++ b/docs/cli/commands/secrets.mdx
@@ -86,6 +86,17 @@ infisical secrets
infisical secrets --path="/" --env=dev
```
+ </Accordion>
+ <Accordion title="--recursive">
+ By default, only the secrets sitting directly in `--path` are listed. Add `--recursive` to also list the secrets in every subfolder of `--path`.
+
+ ```bash
+ # Example
+ infisical secrets --path="/" --env=dev --recursive
+ ```
+
+ Default value: `false`
+
</Accordion>
<Accordion title="--plain">
The `--plain` flag will output all your secret values without formatting, one per line.
diff --git a/docs/snippets/cli/local-development/start-application.mdx b/docs/snippets/cli/local-development/start-application.mdx
index 20135742e6..07f8a00ace 100644
--- a/docs/snippets/cli/local-development/start-application.mdx
+++ b/docs/snippets/cli/local-development/start-application.mdx
@@ -30,6 +30,19 @@ infisical run --env=dev -- dotnet run
The CLI fetches the secrets you have access to and passes them to your application as environment variables. Your application reads them the same way it always has, through `process.env` in Node.js or `os.environ` in Python, so you don't need to change any application code.
+<Note>
+ By default, `infisical run` only injects the secrets sitting at the root of the environment, so anything inside a folder is skipped. If your secrets live in [folders](/documentation/platform/folder), you can specify a folder to include using `--path`:
+
+ ```bash
+ infisical run --env=dev --path="/backend" -- npm run dev
+ ```
+
+ If you also need the secrets in that folder's subfolders, add `--recursive`:
+ ```bash
+ infisical run --env=dev --path="/backend" --recursive -- npm run dev
+ ```
+</Note>
+
<Tip>
Add `--watch` while you work to restart your application automatically whenever one of its secrets changes in Infisical.
</Tip>