Skip to content

Commit

Permalink
Honour the --yes-i-really-mean-it flag when deleting database backups (
Browse files Browse the repository at this point in the history
…#256)

Co-authored-by: Gerrit <[email protected]>
  • Loading branch information
eberlep and Gerrit91 authored Sep 13, 2023
1 parent 96aca6a commit 287c329
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions cmd/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -985,17 +985,19 @@ func (c *config) postgresBackupDelete(args []string) error {
return err
}

idParts := strings.Split(id, "-")
firstPartOfID := idParts[0]
lastPartOfID := idParts[len(idParts)-1]
fmt.Println("Please answer some security questions to delete this postgres database backup")
err = helper.Prompt("first part of ID:", firstPartOfID)
if err != nil {
return err
}
err = helper.Prompt("last part of ID:", lastPartOfID)
if err != nil {
return err
if !viper.GetBool("yes-i-really-mean-it") {
idParts := strings.Split(id, "-")
firstPartOfID := idParts[0]
lastPartOfID := idParts[len(idParts)-1]
fmt.Println("Please answer some security questions to delete this postgres database backup")
err = helper.Prompt("first part of ID:", firstPartOfID)
if err != nil {
return err
}
err = helper.Prompt("last part of ID:", lastPartOfID)
if err != nil {
return err
}
}

request := database.NewDeletePostgresBackupConfigParams().WithID(id)
Expand Down

0 comments on commit 287c329

Please sign in to comment.