From 88ea925263ba6e8816863673b50a131a4f6300c7 Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 29 Jan 2024 16:50:08 +0100 Subject: [PATCH] feat(backend): added new flag USE_S3_TAGS to disable s3 tags --- backend/internal/config/objectstorage/config.go | 1 + backend/pkg/objectstorage/s3/s3.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/backend/internal/config/objectstorage/config.go b/backend/internal/config/objectstorage/config.go index cdcf43b1c..a1ca6568d 100644 --- a/backend/internal/config/objectstorage/config.go +++ b/backend/internal/config/objectstorage/config.go @@ -13,6 +13,7 @@ type ObjectsConfig struct { AWSSkipSSLValidation bool `env:"AWS_SKIP_SSL_VALIDATION"` AzureAccountName string `env:"AZURE_ACCOUNT_NAME"` AzureAccountKey string `env:"AZURE_ACCOUNT_KEY"` + UseS3Tags bool `env:"USE_S3_TAGS,default=true"` } func (c *ObjectsConfig) UseFileTags() bool { diff --git a/backend/pkg/objectstorage/s3/s3.go b/backend/pkg/objectstorage/s3/s3.go index c47c5802a..b86e91d59 100644 --- a/backend/pkg/objectstorage/s3/s3.go +++ b/backend/pkg/objectstorage/s3/s3.go @@ -29,6 +29,7 @@ type storageImpl struct { svc *s3.S3 bucket *string fileTag string + useTags bool } func NewS3(cfg *objConfig.ObjectsConfig) (objectstorage.ObjectStorage, error) { @@ -61,10 +62,14 @@ func NewS3(cfg *objConfig.ObjectsConfig) (objectstorage.ObjectStorage, error) { svc: s3.New(sess), // AWS Docs: "These clients are safe to use concurrently." bucket: &cfg.BucketName, fileTag: loadFileTag(), + useTags: cfg.UseS3Tags, }, nil } func (s *storageImpl) tagging() *string { + if !s.useTags { + return nil + } return &s.fileTag }