From e824008fe22a92032236f18d6b4c02867458e194 Mon Sep 17 00:00:00 2001 From: ridhozhr Date: Wed, 22 May 2019 20:57:32 +0700 Subject: [PATCH] integrate flags with composer gcs object prefix --- cmd/tusd/cli/composer.go | 4 ++-- gcsstore/gcsstore.go | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/tusd/cli/composer.go b/cmd/tusd/cli/composer.go index 2aad4d1..a3c17d8 100644 --- a/cmd/tusd/cli/composer.go +++ b/cmd/tusd/cli/composer.go @@ -5,10 +5,10 @@ import ( "github.com/tus/tusd" "github.com/tus/tusd/filestore" + "github.com/tus/tusd/gcsstore" "github.com/tus/tusd/limitedstore" "github.com/tus/tusd/memorylocker" "github.com/tus/tusd/s3store" - "github.com/tus/tusd/gcsstore" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" @@ -55,7 +55,7 @@ func CreateComposer() { stdout.Printf("Using 'gcs://%s' as GCS bucket for storage.\n", Flags.GCSBucket) - store := gcsstore.New(Flags.GCSBucket, service) + store := gcsstore.New(Flags.GCSBucket, Flags.GCSObjectPrefix, service) store.UseIn(Composer) locker := memorylocker.New() diff --git a/gcsstore/gcsstore.go b/gcsstore/gcsstore.go index 075cd86..2117179 100644 --- a/gcsstore/gcsstore.go +++ b/gcsstore/gcsstore.go @@ -45,10 +45,11 @@ type GCSStore struct { // New constructs a new GCS storage backend using the supplied GCS bucket name // and service object. -func New(bucket string, service GCSAPI) GCSStore { +func New(bucket string, objPrefix string, service GCSAPI) GCSStore { return GCSStore{ - Bucket: bucket, - Service: service, + Bucket: bucket, + ObjectPrefix: objPrefix, + Service: service, } }