switch to official AWS Go SDK

This uses the official Go SDK from Amazon, which supports the newer v4
authentication method.  Fixes #74.  Doing so also required adding a new
s3cache package which uses the official SDK.

THIS IS A BREAKING CHANGE for anyone that uses s3, since the syntax of
the command line flag is now different.  This is unfortunately necessary
because aws-sdk-go always requires the region to be explicitly declared,
which wasn't always the case with the previous format.  This breaking
change is unfortunate, but given that the other s3 package hasn't seen
updates in years, and so many new S3 regions only support the newer v4
authentication method, it's necessary.
This commit is contained in:
Will Norris 2017-09-12 04:11:41 +00:00
parent 5264eb6db0
commit 0ee5167444
3 changed files with 116 additions and 5 deletions

View file

@ -32,8 +32,8 @@ import (
"github.com/gregjones/httpcache/diskcache"
rediscache "github.com/gregjones/httpcache/redis"
"github.com/peterbourgon/diskv"
"sourcegraph.com/sourcegraph/s3cache"
"willnorris.com/go/imageproxy"
"willnorris.com/go/imageproxy/internal/s3cache"
)
var addr = flag.String("addr", "localhost:8080", "TCP address to listen on")
@ -110,8 +110,7 @@ func parseCache() (imageproxy.Cache, error) {
switch u.Scheme {
case "s3":
u.Scheme = "https"
return s3cache.New(u.String()), nil
return s3cache.New(u.String())
case "gcs":
return gcscache.New(u.String()), nil
case "azure":