package resource import ( "bytes" "context" "log" "os" "resource-manager/domain/cache" "strings" "time" ) type UploadRequest struct { Buffer *bytes.Buffer Path string MimeType string Overwrite bool } func NewManager(cacheManager cache.Manager, expiration time.Duration) Manager { if strings.Contains(os.Getenv("PROFILE"), "s3") { log.Println("Manager | using S3 for data storage") return newS3Bucket(cacheManager, expiration) } else { return newLocalFolder(cacheManager, expiration) } } type Manager interface { Upload(request UploadRequest) Download(ctx context.Context, path string) (file []byte, err error) Presign(ctx context.Context, path string) (string, error) Copy(from string, to string, overwrite bool) error Delete(path string) error }