Skip to content

Commit

Permalink
Merge pull request #401 from authzed/print-redacted-object-ids
Browse files Browse the repository at this point in the history
backup redact: print objectID redaction mapping
  • Loading branch information
vroldanbet authored Jul 17, 2024
2 parents 530cfcf + 7dbef3d commit 5178716
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/cmd/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func registerBackupCmd(rootCmd *cobra.Command) {
backupRedactCmd.Flags().Bool("redact-definitions", true, "redact definitions")
backupRedactCmd.Flags().Bool("redact-relations", true, "redact relations")
backupRedactCmd.Flags().Bool("redact-object-ids", true, "redact object IDs")
backupRedactCmd.Flags().Bool("print-redacted-object-ids", false, "prints the redacted object IDs")

// Restore used to be on the root, so add it there too, but hidden.
restoreCmd := &cobra.Command{
Expand Down Expand Up @@ -550,6 +551,15 @@ func backupRedactCmdFunc(cmd *cobra.Command, args []string) error {
tbl.Print()
fmt.Println()

if len(redactor.RedactionMap().ObjectIDs) > 0 && cobrautil.MustGetBool(cmd, "print-redacted-object-ids") {
tbl = table.New("Object ID", "Redacted Object ID")
for k, v := range redactor.RedactionMap().ObjectIDs {
tbl.AddRow(k, v)
}
tbl.Print()
fmt.Println()
}

return nil
}

Expand Down

0 comments on commit 5178716

Please sign in to comment.