feat(backend): added new flag USE_S3_TAGS to disable s3 tags

This commit is contained in:
Alexander 2024-01-29 16:50:08 +01:00
parent 76f0f3ff3d
commit 88ea925263
2 changed files with 6 additions and 0 deletions

View file

@ -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 {

View file

@ -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
}