summaryrefslogtreecommitdiff
path: root/internal/storage
diff options
context:
space:
mode:
Diffstat (limited to 'internal/storage')
-rw-r--r--internal/storage/s3.go8
-rw-r--r--internal/storage/storage.go6
2 files changed, 12 insertions, 2 deletions
diff --git a/internal/storage/s3.go b/internal/storage/s3.go
index ee51bea89..1b191f675 100644
--- a/internal/storage/s3.go
+++ b/internal/storage/s3.go
@@ -34,12 +34,14 @@ import (
type S3 struct {
mc *minio.Client
bucket string
+ proxy bool
}
-func NewS3(mc *minio.Client, bucket string) *S3 {
+func NewS3(mc *minio.Client, bucket string, proxy bool) *S3 {
return &S3{
mc: mc,
bucket: bucket,
+ proxy: proxy,
}
}
@@ -83,6 +85,10 @@ func (s *S3) Delete(ctx context.Context, key string) error {
}
func (s *S3) URL(ctx context.Context, key string) *url.URL {
+ if s.proxy {
+ return nil
+ }
+
// it's safe to ignore the error here, as we just fall back to fetching the
// file if the url request fails
url, _ := s.mc.PresignedGetObject(ctx, s.bucket, key, time.Hour, url.Values{
diff --git a/internal/storage/storage.go b/internal/storage/storage.go
index e44c47184..303283f90 100644
--- a/internal/storage/storage.go
+++ b/internal/storage/storage.go
@@ -59,7 +59,11 @@ func AutoConfig() (Driver, error) {
if err != nil {
return nil, fmt.Errorf("creating minio client: %w", err)
}
- return NewS3(mc, config.GetStorageS3BucketName()), nil
+ return NewS3(
+ mc,
+ config.GetStorageS3BucketName(),
+ config.GetStorageS3Proxy(),
+ ), nil
case "local":
basePath := config.GetStorageLocalBasePath()
disk, err := storage.OpenDisk(basePath, &storage.DiskConfig{