zot
zot copied to clipboard
s3: add a 'redirect' flag in storageDriver params and based on it serve blobs or redirect to S3 URLs
Is your feature request related to a problem? Please describe. When using s3 as backend storage zot first downloads blobs from s3 and then serves them thus wasting time. It should be able to use redirects to s3 urls based on a 'redirect' flag in storageDriver config parameters.
Describe the solution you'd like
If redirect flag is true then:
- use path := storage.BlobPath() to get path to blob
- use url := storageDriver.URLFor(path)
- in routes use http.Redirect(url) and serve the URLs instead of blobs.
we can add a new func to Storage interface URLForPath(path) that calls storageDriver.URLFor(path) for filesystem storage return a err.NotImplemented.