Skip to content

Commit

Permalink
add, log and add option to show version
Browse files Browse the repository at this point in the history
  • Loading branch information
abbbi committed Jan 7, 2025
1 parent cd75d7b commit 85d0cee
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/garbagecollector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,25 @@ func getObjectMetdata(ctx context.Context, bucketFlag string, object minio.Objec
}

func main() {
s3backuplog.InfoPrint("%s version: %s", os.Args[0], s3pmoxcommon.PROXY_VERSION)
var printVersion bool
endpointFlag := flag.String("endpoint", "", "S3 Endpoint without https/http , host:port")
secureFlag := flag.Bool("usessl", false, "Use SSL for endpoint connection: default: false")
bucketFlag := flag.String("bucket", "", "Bucket to perform garbage collection on")
accessKeyID := flag.String("accesskey", "", "S3 Access Key ID")
secretKey := flag.String("secretkey", "", "S3 Secret Key, discouraged , use a file if possible")
secretKeyFile := flag.String("secretkeyfile", "", "S3 Secret Key File")
retentionDays := flag.Uint("retention", 60, "Number of days to keep backups for")
flag.BoolVar(&printVersion, "version", false, "Show version and exit")
flag.BoolVar(&printVersion, "v", false, "Show version and exit")

lookupTypeFlag := flag.String("lookuptype", "auto", "Bucket lookup type: auto,dns,path")
debug := flag.Bool("debug", false, "Debug logging")
flag.Parse()
if printVersion {
fmt.Println(s3pmoxcommon.PROXY_VERSION)
os.Exit(0)
}
if *endpointFlag == "" || *accessKeyID == "" || (*secretKey == "" && *secretKeyFile == "") || *bucketFlag == "" {
flag.Usage()
os.Exit(1)
Expand Down
8 changes: 8 additions & 0 deletions cmd/pmoxs3backuproxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ func certFingeprint(cfile string) *string {
}

func main() {
s3backuplog.InfoPrint("%s version: %s", os.Args[0], s3pmoxcommon.PROXY_VERSION)
var printVersion bool
certFlag := flag.String("cert", "server.crt", "Server SSL certificate file")
keyFlag := flag.String("key", "server.key", "Server SSL key file")
endpointFlag := flag.String("endpoint", "", "S3 Endpoint without https/http , host:port")
Expand All @@ -116,7 +118,13 @@ func main() {
ticketExpireFlag := flag.Uint64("ticketexpire", 3600, "API Ticket expire time in seconds")
lookupTypeFlag := flag.String("lookuptype", "auto", "Bucket lookup type: auto,dns,path")
debug := flag.Bool("debug", false, "Debug logging")
flag.BoolVar(&printVersion, "version", false, "Show version and exit")
flag.BoolVar(&printVersion, "v", false, "Show version and exit")
flag.Parse()
if printVersion {
fmt.Println(s3pmoxcommon.PROXY_VERSION)
os.Exit(0)
}
if *endpointFlag == "" {
flag.Usage()
os.Exit(1)
Expand Down
1 change: 1 addition & 0 deletions internal/s3pmoxcommon/types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package s3pmoxcommon

var PROXY_VERSION string = "0.0.5"
var PROXMOX_INDEX_MAGIC_DYNAMIC = [8]byte{28, 145, 78, 165, 25, 186, 179, 205}
var PROXMOX_INDEX_MAGIC_FIXED = [8]byte{47, 127, 65, 237, 145, 253, 15, 205}

Expand Down

0 comments on commit 85d0cee

Please sign in to comment.