From 0c20cbe5b5828cfd74d1fa5c4ea6c15d2b80d6be Mon Sep 17 00:00:00 2001 From: Will Norris Date: Fri, 2 Feb 2018 10:05:56 +0000 Subject: [PATCH] switch to use internal gcscache --- README.md | 6 ++++-- cmd/imageproxy/main.go | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5237751..59613e8 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/cmd/imageproxy/main.go b/cmd/imageproxy/main.go index 6b1757d..966d6b6 100644 --- a/cmd/imageproxy/main.go +++ b/cmd/imageproxy/main.go @@ -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":