Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Address PR feedback
Edgar Ramírez Mondragón793eaee0c602
diff --git a/cli/packages/cmd/export.go b/cli/packages/cmd/export.goindex 72d36dd841..93bfca049e 100644--- a/cli/packages/cmd/export.go+++ b/cli/packages/cmd/export.go@@ -25,7 +25,7 @@ var exportCmd = &cobra.Command{Use: "export",Short: "Used to export environment variables to a file",DisableFlagsInUseLine: true,- Example: "infisical export --env=prod --format=json",+ Example: "infisical export --env=prod --format=json > secrets.json",Args: cobra.NoArgs,PreRun: toggleDebug,Run: func(cmd *cobra.Command, args []string) {@@ -67,13 +67,13 @@ var exportCmd = &cobra.Command{var output stringif shouldExpandSecrets {substitutions := util.SubstituteSecrets(envsFromApi)- output, err = formatEnvs(envName, substitutions, format)+ output, err = formatEnvs(substitutions, format)if err != nil {log.Errorln(err)return}} else {- output, err = formatEnvs(envName, envsFromApi, format)+ output, err = formatEnvs(envsFromApi, format)if err != nil {log.Errorln(err)return@@ -92,7 +92,7 @@ func init() {}// Format according to the format flag-func formatEnvs(_ string, envs []models.SingleEnvironmentVariable, format string) (string, error) {+func formatEnvs(envs []models.SingleEnvironmentVariable, format string) (string, error) {switch strings.ToLower(format) {case FormatDotenv:return formatAsDotEnv(envs), nildiff --git a/docs/cli/export.mdx b/docs/cli/export.mdxindex 9e03933364..10a77612e1 100644--- a/docs/cli/export.mdx+++ b/docs/cli/export.mdx@@ -12,12 +12,12 @@ Export environment variables from the platform into a file format.## Options-| Option | Description | Default value |-| ------------- | ----------------------------------------------------------------------------------------------------------- | ------------- |-| `--env` | Used to set the environment that secrets are pulled from. Accepted values: `dev`, `staging`, `test`, `prod` | `dev` |-| `--projectId` | Used to link a local project to the platform (required only if injecting via the service token method) | `None` |-| `--expand` | Parse shell parameter expansions in your secrets (e.g., `${DOMAIN}`) | `true` |-| `--format` | Format of the output file. Accepted values: `dotenv`, `csv` and `json` | `dotenv` |+| Option | Description | Default value |+| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |+| `--env` | Used to set the environment that secrets are pulled from. Accepted values: `dev`, `staging`, `test`, `prod` | `dev` |+| `--projectId` | Used to determine from which infisical project your secrets will be exported from (only required if injecting via the service token method). | `None` |+| `--expand` | Parse shell parameter expansions in your secrets (e.g., `${DOMAIN}`) | `true` |+| `--format` | Format of the output file. Accepted values: `dotenv`, `csv` and `json` | `dotenv` |## Examples