Skip to content

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

update docs to reflect the new behavior

adilsond432cf6b9e96
diff --git a/docs/cli/project-config-migration.mdx b/docs/cli/project-config-migration.mdx
index 91f7ec0b7b..279bfdf4c9 100644
--- a/docs/cli/project-config-migration.mdx
+++ b/docs/cli/project-config-migration.mdx
@@ -1,6 +1,6 @@
---
title: "Migrate to .infisical.yaml"
-description: "The Infisical CLI now reads project settings from `.infisical.yaml` instead of `.infisical.json`. Learn how to convert your project's configuration file."
+description: "The Infisical CLI now reads project settings from `.infisical.yaml` instead of `.infisical.json`, and creates `.infisical.yaml` from an existing `.infisical.json`. Learn how to finish the migration."
---
## What changed
@@ -22,36 +22,44 @@ Older versions of the CLI don't read `.infisical.yaml`, so after you delete `.in
## Migration steps
-Convert the file with the `infisical migrate-config` command, or edit it by hand.
+Let the CLI create `.infisical.yaml` from `.infisical.json`, or create `.infisical.yaml` by hand.
<Tabs>
- <Tab title="Run migrate-config">
+ <Tab title="Let the CLI create the file">
+ <Note>
+ The CLI creates `.infisical.yaml` for you in version 0.44.3 and later. If your CLI is older, [upgrade it](/cli/upgrade) or create `.infisical.yaml` by hand.
+ </Note>
+
<Steps>
<Step>
- In the directory that holds `.infisical.json`, run:
+ In the directory that holds `.infisical.json`, run any `infisical` command, such as:
```bash
- infisical migrate-config
+ infisical secrets
```
- The command copies every setting from `.infisical.json` into a new `.infisical.yaml` in the same directory, deletes `.infisical.json`, and prints the paths of both files:
+ If you pass `--silent`, request JSON, CSV, or YAML output, or run the CLI in a Docker container, the CLI creates `.infisical.yaml` only when the command reads the project settings, as `infisical secrets` does.
+
+ The CLI copies every setting from `.infisical.json` into a new `.infisical.yaml` in the same directory, leaves `.infisical.json` in place, and prints the paths of both files:
```
- Migrated /home/user/my-app/.infisical.json to /home/user/my-app/.infisical.yaml.
- If this project is under version control, commit the new .infisical.yaml and the removal of .infisical.json.
+ Created /home/user/my-app/.infisical.yaml from the legacy /home/user/my-app/.infisical.json, which was left in place. .infisical.yaml now takes precedence, so future changes belong there; commit it and delete the legacy file when ready.
```
</Step>
<Step>
- Commit the new file and the deletion of the old one:
+ Delete `.infisical.json`, then commit the new file and the deletion:
```bash
+ rm .infisical.json
git add .infisical.yaml .infisical.json
git commit -m "Migrate Infisical CLI config to .infisical.yaml"
```
</Step>
</Steps>
- The command converts one file. If your repository has more than one `.infisical.json`, such as one per package in a monorepo, run the command in each directory that holds one.
+ If your repository has more than one `.infisical.json`, such as one per package in a monorepo, run a command in each directory that holds one.
+
+ If the CLI can't write `.infisical.yaml`, for example because the directory is read-only, the command still runs with the settings in `.infisical.json`, and the CLI tries again the next time you run a command. At most once a day, the CLI also prints a deprecation notice that names the directory it couldn't write to. To finish the migration, make the directory writable and run a command again, or follow the steps in the **Edit the file by hand** tab.
</Tab>
<Tab title="Edit the file by hand">
@@ -131,19 +139,22 @@ Check that the command lists the secrets from the project and environment you ex
<AccordionGroup>
<Accordion title="What if .infisical.json and .infisical.yaml are in the same directory?">
- The CLI can read both `.infisical.yaml` and `.infisical.json`. But
- `.infisical.yaml` takes precedence
+ The CLI reads `.infisical.yaml` and ignores `.infisical.json`, so changes
+ you make to `.infisical.json` don't apply. Make any changes in
+ `.infisical.yaml`.
</Accordion>
- <Accordion title="Can I run infisical init instead of migrate-config?">
+ <Accordion title="Can I run infisical init instead?">
`infisical init` writes a new `.infisical.yaml` that holds only the project
ID, so you lose the environment, branch mapping, folder, and instance
- settings from `.infisical.json`. To keep those settings, run `infisical
- migrate-config`.
+ settings from `.infisical.json`. To keep those settings, let the CLI create
+ `.infisical.yaml` from `.infisical.json`, or create `.infisical.yaml` by
+ hand.
</Accordion>
<Accordion title="How do I hide the deprecation notice?">
- Set the `INFISICAL_DISABLE_WORKSPACE_CONFIG_MIGRATION_NOTICE` environment
- variable to any value, such as `true`. The CLI prints the notice at most
- once a day and writes it to standard error, so the notice doesn't change the
- output of commands like `infisical export`.
+ The notice stops once `.infisical.yaml` exists. To hide the notice before
+ then, set the `INFISICAL_DISABLE_WORKSPACE_CONFIG_MIGRATION_NOTICE`
+ environment variable to any value, such as `true`. Both the notice and the
+ message the CLI prints when it creates `.infisical.yaml` go to standard
+ error, so they don't change the output of commands like `infisical export`.
</Accordion>
</AccordionGroup>
diff --git a/docs/cli/project-config.mdx b/docs/cli/project-config.mdx
index 08ecbdebe5..4ab7fbe1e6 100644
--- a/docs/cli/project-config.mdx
+++ b/docs/cli/project-config.mdx
@@ -4,7 +4,7 @@ description: "Configure how the Infisical CLI interacts with your directory."
---
<Warning>
- `.infisical.yaml` replaces `.infisical.json`, which is deprecated. The CLI still reads `.infisical.json`, so directories that have one keep working without any changes. To move to the new format, [convert it to `.infisical.yaml`](/cli/project-config-migration).
+ `.infisical.yaml` replaces `.infisical.json`, which is deprecated. The CLI still reads `.infisical.json`. Starting with version 0.44.3, the CLI also creates `.infisical.yaml` with the same settings the first time a command reads `.infisical.json`. To finish moving to the new format, see [Migrate to .infisical.yaml](/cli/project-config-migration).
</Warning>
`.infisical.yaml` links a directory to an [Infisical project](/documentation/platform/project). When you run a command such as [`infisical sm run`](/cli/reference#sm-run) or [`infisical sm secrets`](/cli/reference#sm-secrets) in that directory, the CLI reads the project from the file, so you don't have to pass [`--projectId`](/cli/reference#sm-run--flag-projectid).