From bc917a4085f8f6195e70d55b751b08cc5a93059c Mon Sep 17 00:00:00 2001 From: Dominik Süß Date: Fri, 2 Dec 2022 19:40:49 +0100 Subject: [performance]: make s3 urls cacheable (#1194) Implements #864 and should speed up s3 based installations by a lot. With more static urls, we can then also implement #1026 for even better performance when used in conjunction with CDNs --- testrig/storage.go | 35 ----------------------------------- 1 file changed, 35 deletions(-) (limited to 'testrig/storage.go') diff --git a/testrig/storage.go b/testrig/storage.go index 20226089c..7d3f3be71 100644 --- a/testrig/storage.go +++ b/testrig/storage.go @@ -26,9 +26,6 @@ import ( "codeberg.org/gruf/go-store/v2/kv" "codeberg.org/gruf/go-store/v2/storage" - "github.com/minio/minio-go/v7" - "github.com/minio/minio-go/v7/pkg/credentials" - "github.com/superseriousbusiness/gotosocial/internal/config" gtsstorage "github.com/superseriousbusiness/gotosocial/internal/storage" ) @@ -41,38 +38,6 @@ func NewInMemoryStorage() *gtsstorage.Driver { } } -func NewS3Storage() *gtsstorage.Driver { - endpoint := config.GetStorageS3Endpoint() - access := config.GetStorageS3AccessKey() - secret := config.GetStorageS3SecretKey() - secure := config.GetStorageS3UseSSL() - bucket := config.GetStorageS3BucketName() - proxy := config.GetStorageS3Proxy() - - s3, err := storage.OpenS3(endpoint, bucket, &storage.S3Config{ - CoreOpts: minio.Options{ - Creds: credentials.NewStaticV4(access, secret, ""), - Secure: secure, - }, - GetOpts: minio.GetObjectOptions{}, - PutOpts: minio.PutObjectOptions{}, - PutChunkSize: 5 * 1024 * 1024, // 2MiB - StatOpts: minio.StatObjectOptions{}, - RemoveOpts: minio.RemoveObjectOptions{}, - ListSize: 200, - }) - if err != nil { - panic(fmt.Errorf("error opening s3 storage: %w", err)) - } - - return >sstorage.Driver{ - KVStore: kv.New(s3), - Storage: s3, - Proxy: proxy, - Bucket: bucket, - } -} - // StandardStorageSetup populates the storage with standard test entries from the given directory. func StandardStorageSetup(storage *gtsstorage.Driver, relativePath string) { storedA := newTestStoredAttachments() -- cgit v1.2.3