mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-26 13:26:23 +02:00
s3cache: expose add'l config options as URL params
this should allow using at least some s3-compatible services like minio. Fixes #120, #147
This commit is contained in:
parent
a903995ee7
commit
e860748032
2 changed files with 31 additions and 1 deletions
|
|
@ -97,7 +97,21 @@ func New(s string) (*cache, error) {
|
|||
prefix = path[1]
|
||||
}
|
||||
|
||||
sess, err := session.NewSession(&aws.Config{Region: ®ion})
|
||||
config := aws.NewConfig().WithRegion(region)
|
||||
|
||||
// allow overriding some additional config options, mostly useful when
|
||||
// working with s3-compatible services other than AWS.
|
||||
if v := u.Query().Get("endpoint"); v != "" {
|
||||
config = config.WithEndpoint(v)
|
||||
}
|
||||
if v := u.Query().Get("disableSSL"); v == "1" {
|
||||
config = config.WithDisableSSL(true)
|
||||
}
|
||||
if v := u.Query().Get("s3ForcePathStyle"); v == "1" {
|
||||
config = config.WithS3ForcePathStyle(true)
|
||||
}
|
||||
|
||||
sess, err := session.NewSession(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue