mirror of
https://github.com/willnorris/imageproxy.git
synced 2024-12-16 21:56:43 -05:00
add GCS cache
This commit is contained in:
parent
0fe3656939
commit
4b637567e3
2 changed files with 6 additions and 0 deletions
|
@ -102,6 +102,9 @@ enabled using the `-cache` flag. It supports the following values:
|
||||||
images on Amazon S3. This requires either an IAM role and instance profile
|
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`
|
with access to your your bucket or `AWS_ACCESS_KEY_ID` and `AWS_SECRET_KEY`
|
||||||
environmental parameters set.
|
environmental parameters set.
|
||||||
|
- GCS URL (e.g. `gcs://bucket-name/optional-path-prefix`) - will cache
|
||||||
|
images on Google Cloud Storage. This requires `GCP_PRIVATE_KEY` environmental
|
||||||
|
parameters set.
|
||||||
|
|
||||||
For example, to cache files on disk in the `/tmp/imageproxy` directory:
|
For example, to cache files on disk in the `/tmp/imageproxy` directory:
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/diegomarangoni/gcscache"
|
||||||
"github.com/gregjones/httpcache"
|
"github.com/gregjones/httpcache"
|
||||||
"github.com/gregjones/httpcache/diskcache"
|
"github.com/gregjones/httpcache/diskcache"
|
||||||
"github.com/peterbourgon/diskv"
|
"github.com/peterbourgon/diskv"
|
||||||
|
@ -126,6 +127,8 @@ func parseCache() (imageproxy.Cache, error) {
|
||||||
case "s3":
|
case "s3":
|
||||||
u.Scheme = "https"
|
u.Scheme = "https"
|
||||||
return s3cache.New(u.String()), nil
|
return s3cache.New(u.String()), nil
|
||||||
|
case "gcs":
|
||||||
|
return gcscache.New(u.String()), nil
|
||||||
case "file":
|
case "file":
|
||||||
fallthrough
|
fallthrough
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue