diff --git a/README.md b/README.md index 744d47c..9010213 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,10 @@ enabled using the `-cache` flag. It supports the following values: available memory and is not recommended for production systems) - directory on local disk (e.g. `/tmp/imageproxy`) - will cache images on disk, limited to the size specified in the `-cacheSize` flag. + - s3 URL (e.g. `s3://s3-us-west-2.amazonaws.com/my-bucket`) - will cache + images on Amazon S3. This requires either an IAM role and instance profile + with access to your your bucket or `AWS_ACCESS_KEY_ID` and `AWS_SECRET_KEY` + environmental parameters set. For example, to cache files on disk, allowing up to 100MB of space: diff --git a/cmd/imageproxy/main.go b/cmd/imageproxy/main.go index ec7ff29..14fa7cc 100644 --- a/cmd/imageproxy/main.go +++ b/cmd/imageproxy/main.go @@ -27,6 +27,7 @@ import ( "github.com/gregjones/httpcache" "github.com/gregjones/httpcache/diskcache" "github.com/peterbourgon/diskv" + "sourcegraph.com/sourcegraph/s3cache" "willnorris.com/go/imageproxy" ) @@ -120,6 +121,9 @@ func parseCache() (imageproxy.Cache, error) { } switch u.Scheme { + case "s3": + u.Scheme = "https" + return s3cache.New(u.String()), nil case "file": fallthrough default: