Skip to content

Commit

Permalink
Add read only flag for data-retention
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmarklloyd committed Dec 5, 2021
1 parent a47fed8 commit c0374e5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/data-retention/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bufio"
"context"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
Expand Down Expand Up @@ -289,6 +290,9 @@ func initConfig() Config {
}

func main() {
readOnly := flag.Bool("read-only", false, "Only show number of rows above max, do not update backup file or delete rows")
flag.Parse()

config := initConfig()
bucketName := fmt.Sprintf("backup-%s", config.AppName)
backupFileName := "cold-storage.csv"
Expand All @@ -302,6 +306,10 @@ func main() {
if numberRowsAboveMax == 0 {
os.Exit(0)
}
if *readOnly {
fmt.Println("Read only mode")
os.Exit(0)
}

backupFileId, err := getOrCreateBackupFile(config.Service, bucketName, backupFileName)
checkErr(err)
Expand Down

0 comments on commit c0374e5

Please sign in to comment.