diff --git a/main.go b/main.go
index 85f441c..b4723fa 100644
--- a/main.go
+++ b/main.go
@@ -109,8 +109,8 @@ var cli struct {
} `cmd:"" help:"Download a local archive to remote storage." hidden:""`
Upload struct {
- Input string `arg:"" type:"existingfile"`
- Key string `arg:""`
+ InputPmtiles string `arg:"" type:"existingfile" help:"The local PMTiles file"`
+ RemotePmtiles string `arg:"" help:"The name for the remote PMTiles source"`
MaxConcurrency int `default:"2" help:"# of upload threads"`
Bucket string `required:"" help:"Bucket to upload to."`
} `cmd:"" help:"Upload a local archive to remote storage."`
@@ -203,8 +203,8 @@ func main() {
if err != nil {
logger.Fatalf("Failed to convert %s, %v", path, err)
}
- case "upload ":
- err := pmtiles.Upload(logger, cli.Upload.Input, cli.Upload.Bucket, cli.Upload.Key, cli.Upload.MaxConcurrency)
+ case "upload ":
+ err := pmtiles.Upload(logger, cli.Upload.InputPmtiles, cli.Upload.Bucket, cli.Upload.RemotePmtiles, cli.Upload.MaxConcurrency)
if err != nil {
logger.Fatalf("Failed to upload file, %v", err)
diff --git a/pmtiles/upload.go b/pmtiles/upload.go
index 53c52eb..f8954e8 100644
--- a/pmtiles/upload.go
+++ b/pmtiles/upload.go
@@ -19,7 +19,7 @@ func partSizeBytes(totalSize int64) int {
}
// Upload a pmtiles archive to a bucket.
-func Upload(logger *log.Logger, input string, bucket string, key string, maxConcurrency int) error {
+func Upload(logger *log.Logger, InputPMTiles string, bucket string, RemotePMTiles string, maxConcurrency int) error {
ctx := context.Background()
b, err := blob.OpenBucket(ctx, bucket)
@@ -28,7 +28,7 @@ func Upload(logger *log.Logger, input string, bucket string, key string, maxConc
}
defer b.Close()
- f, err := os.Open(input)
+ f, err := os.Open(InputPMTiles)
if err != nil {
return fmt.Errorf("Failed to open file: %w", err)
}
@@ -44,7 +44,7 @@ func Upload(logger *log.Logger, input string, bucket string, key string, maxConc
MaxConcurrency: maxConcurrency,
}
- w, err := b.NewWriter(ctx, key, opts)
+ w, err := b.NewWriter(ctx, RemotePMTiles, opts)
if err != nil {
return fmt.Errorf("Failed to obtain writer: %w", err)
}