0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-16 21:56:43 -05:00

switch to use internal gcscache

This commit is contained in:
Will Norris 2018-02-02 10:05:56 +00:00
parent 7bf3645c10
commit 0c20cbe5b5
2 changed files with 6 additions and 4 deletions

View file

@ -111,10 +111,12 @@ enabled using the `-cache` flag. It supports the following values:
are documented in the [aws-sdk-go session
package](https://docs.aws.amazon.com/sdk-for-go/api/aws/session/)).
- gcs URL (e.g. `gcs://bucket-name/optional-path-prefix`) - will cache images
on Google Cloud Storage. This requires `GCP_PRIVATE_KEY` environmental
variable be set.
on Google Cloud Storage. Authentication is documented in Google's
[Application Default Credentials
docs](https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application).
- azure URL (e.g. `azure://container-name/`) - will cache images on
Azure Storage. This requires `AZURESTORAGE_ACCOUNT_NAME` and
`AZURESTORAGE_ACCESS_KEY` environment variables to bet set.
- redis URL (e.g. `redis://hostname/`) - will cache images on
the specified redis host. The full URL syntax is defined by the [redis URI
registration](https://www.iana.org/assignments/uri-schemes/prov/redis).

View file

@ -30,12 +30,12 @@ import (
"github.com/PaulARoy/azurestoragecache"
"github.com/die-net/lrucache"
"github.com/die-net/lrucache/twotier"
"github.com/diegomarangoni/gcscache"
"github.com/garyburd/redigo/redis"
"github.com/gregjones/httpcache/diskcache"
rediscache "github.com/gregjones/httpcache/redis"
"github.com/peterbourgon/diskv"
"willnorris.com/go/imageproxy"
"willnorris.com/go/imageproxy/internal/gcscache"
"willnorris.com/go/imageproxy/internal/s3cache"
)
@ -142,7 +142,7 @@ func parseCache(c string) (imageproxy.Cache, error) {
case "azure":
return azurestoragecache.New("", "", u.Host)
case "gcs":
return gcscache.New(u.String()), nil
return gcscache.New(u.Host, strings.TrimPrefix(u.Path, "/"))
case "memory":
return lruCache(u.Opaque)
case "redis":