integrate flags with composer gcs object prefix

This commit is contained in:
ridhozhr 2019-05-22 20:57:32 +07:00
parent bb2ee4cf41
commit e824008fe2
2 changed files with 6 additions and 5 deletions

View File

@ -5,10 +5,10 @@ import (
"github.com/tus/tusd" "github.com/tus/tusd"
"github.com/tus/tusd/filestore" "github.com/tus/tusd/filestore"
"github.com/tus/tusd/gcsstore"
"github.com/tus/tusd/limitedstore" "github.com/tus/tusd/limitedstore"
"github.com/tus/tusd/memorylocker" "github.com/tus/tusd/memorylocker"
"github.com/tus/tusd/s3store" "github.com/tus/tusd/s3store"
"github.com/tus/tusd/gcsstore"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session" "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) 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) store.UseIn(Composer)
locker := memorylocker.New() locker := memorylocker.New()

View File

@ -45,10 +45,11 @@ type GCSStore struct {
// New constructs a new GCS storage backend using the supplied GCS bucket name // New constructs a new GCS storage backend using the supplied GCS bucket name
// and service object. // and service object.
func New(bucket string, service GCSAPI) GCSStore { func New(bucket string, objPrefix string, service GCSAPI) GCSStore {
return GCSStore{ return GCSStore{
Bucket: bucket, Bucket: bucket,
Service: service, ObjectPrefix: objPrefix,
Service: service,
} }
} }