From a3b42286856cd47440a6d5ba9852a9b4a84ba566 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sat, 8 Jul 2023 16:15:45 -0400 Subject: [PATCH] add path to export command --- cli/packages/cmd/export.go | 8 +++++++- docs/cli/commands/export.mdx | 9 +++++++++ docs/cli/commands/secrets.mdx | 25 +++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/cli/packages/cmd/export.go b/cli/packages/cmd/export.go index c41750134..475aee802 100644 --- a/cli/packages/cmd/export.go +++ b/cli/packages/cmd/export.go @@ -70,7 +70,12 @@ var exportCmd = &cobra.Command{ util.HandleError(err, "Unable to parse flag") } - secrets, err := util.GetAllEnvironmentVariables(models.GetAllSecretsParameters{Environment: environmentName, InfisicalToken: infisicalToken, TagSlugs: tagSlugs, WorkspaceId: projectId}) + secretsPath, err := cmd.Flags().GetString("path") + if err != nil { + util.HandleError(err, "Unable to parse flag") + } + + secrets, err := util.GetAllEnvironmentVariables(models.GetAllSecretsParameters{Environment: environmentName, InfisicalToken: infisicalToken, TagSlugs: tagSlugs, WorkspaceId: projectId, SecretsPath: secretsPath}) if err != nil { util.HandleError(err, "Unable to fetch secrets") } @@ -110,6 +115,7 @@ func init() { exportCmd.Flags().String("token", "", "Fetch secrets using the Infisical Token") exportCmd.Flags().StringP("tags", "t", "", "filter secrets by tag slugs") exportCmd.Flags().String("projectId", "", "manually set the projectId to fetch secrets from") + exportCmd.Flags().String("path", "/", "get secrets within a folder path") } // Format according to the format flag diff --git a/docs/cli/commands/export.mdx b/docs/cli/commands/export.mdx index 59d15ed2f..9ba15c34d 100644 --- a/docs/cli/commands/export.mdx +++ b/docs/cli/commands/export.mdx @@ -99,6 +99,15 @@ Export environment variables from the platform into a file format. Default value: `true` + + The `--path` flag indicates which project folder secrets will be injected from. + + ```bash + # Example + infisical export --path="/path/to/folder" --env=dev + ``` + + When working with tags, you can use this flag to filter and retrieve only secrets that are associated with a specific tag(s). diff --git a/docs/cli/commands/secrets.mdx b/docs/cli/commands/secrets.mdx index 3b1ccd3fb..a15829d5f 100644 --- a/docs/cli/commands/secrets.mdx +++ b/docs/cli/commands/secrets.mdx @@ -51,6 +51,14 @@ This command enables you to perform CRUD (create, read, update, delete) operatio Default value: `dev` + + The `--path` flag indicates which project folder secrets will be injected from. + + ```bash + # Example + infisical secrets --path="/" --env=dev + ``` + @@ -90,6 +98,15 @@ $ infisical secrets set STRIPE_API_KEY=sjdgwkeudyjwe DOMAIN=example.com HASH=jeb Default value: `dev` + + The `--path` flag indicates which project folder secrets will be injected from. + + ```bash + # Example + infisical secrets set ... --path="/" + ``` + + @@ -108,6 +125,14 @@ $ infisical secrets set STRIPE_API_KEY=sjdgwkeudyjwe DOMAIN=example.com HASH=jeb Default value: `dev` + + The `--path` flag indicates which project folder secrets will be injected from. + + ```bash + # Example + infisical secrets delete ... --path="/" + ``` +