From f1ef8af9ec8eb8881f793b76218176489175f542 Mon Sep 17 00:00:00 2001 From: Paul Roy Date: Wed, 28 Dec 2016 18:36:30 +0100 Subject: [PATCH] adding azure support --- README.md | 11 +++++++---- cmd/imageproxy/main.go | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 01d6a0d..6067e2c 100644 --- a/README.md +++ b/README.md @@ -101,10 +101,13 @@ enabled using the `-cache` flag. It supports the following values: - 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. - - 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. + environmental variables be set. + - 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. + - azure URL (e.g. `azure://container-name/`) - will cache images on + Azure Storage. This requires `AZURESTORAGE_ACCOUNT_NAME` and + `AZURESTORAGE_ACCESS_KEY` environmental variables set. For example, to cache files on disk in the `/tmp/imageproxy` directory: diff --git a/cmd/imageproxy/main.go b/cmd/imageproxy/main.go index 71d7d77..685a6da 100644 --- a/cmd/imageproxy/main.go +++ b/cmd/imageproxy/main.go @@ -24,6 +24,7 @@ import ( "net/url" "strings" + "github.com/PaulARoy/azurestoragecache" "github.com/diegomarangoni/gcscache" "github.com/gregjones/httpcache" "github.com/gregjones/httpcache/diskcache" @@ -129,6 +130,8 @@ func parseCache() (imageproxy.Cache, error) { return s3cache.New(u.String()), nil case "gcs": return gcscache.New(u.String()), nil + case "azure": + return azurestoragecache.New("", "", u.Host) case "file": fallthrough default: