Feat: Added include imports to export command

This commit is contained in:
Daniel Hougaard
2024-04-05 17:30:30 -07:00
parent dcbbb67f03
commit 8f1e662688
+11 -4
View File
@@ -44,6 +44,11 @@ var exportCmd = &cobra.Command{
util.HandleError(err) util.HandleError(err)
} }
includeImports, err := cmd.Flags().GetBool("include-imports")
if err != nil {
util.HandleError(err)
}
projectId, err := cmd.Flags().GetString("projectId") projectId, err := cmd.Flags().GetString("projectId")
if err != nil { if err != nil {
util.HandleError(err) util.HandleError(err)
@@ -75,10 +80,11 @@ var exportCmd = &cobra.Command{
} }
request := models.GetAllSecretsParameters{ request := models.GetAllSecretsParameters{
Environment: environmentName, Environment: environmentName,
TagSlugs: tagSlugs, TagSlugs: tagSlugs,
WorkspaceId: projectId, WorkspaceId: projectId,
SecretsPath: secretsPath, SecretsPath: secretsPath,
IncludeImport: includeImports,
} }
if token != nil && token.Type == "service-token" { if token != nil && token.Type == "service-token" {
@@ -129,6 +135,7 @@ func init() {
exportCmd.Flags().Bool("expand", true, "Parse shell parameter expansions in your secrets") exportCmd.Flags().Bool("expand", true, "Parse shell parameter expansions in your secrets")
exportCmd.Flags().StringP("format", "f", "dotenv", "Set the format of the output file (dotenv, json, csv)") exportCmd.Flags().StringP("format", "f", "dotenv", "Set the format of the output file (dotenv, json, csv)")
exportCmd.Flags().Bool("secret-overriding", true, "Prioritizes personal secrets, if any, with the same name over shared secrets") exportCmd.Flags().Bool("secret-overriding", true, "Prioritizes personal secrets, if any, with the same name over shared secrets")
exportCmd.Flags().Bool("include-imports", true, "Imported linked secrets")
exportCmd.Flags().String("token", "", "Fetch secrets using the Infisical Token") exportCmd.Flags().String("token", "", "Fetch secrets using the Infisical Token")
exportCmd.Flags().StringP("tags", "t", "", "filter secrets by tag slugs") 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("projectId", "", "manually set the projectId to fetch secrets from")