Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new isAws flag to enable aws v2 api #583

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/common/conf_s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type S3Config struct {
Session *session.Session

BucketOwner string
IsAws bool
}

var s3Session *session.Session
Expand Down
1 change: 1 addition & 0 deletions api/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type FlagStorage struct {

// Common Backend Config
UseContentType bool
IsAws bool
Endpoint string

Backend interface{}
Expand Down
2 changes: 1 addition & 1 deletion internal/backend_s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (s *S3Backend) detectBucketLocationByHEAD() (err error, isAws bool) {
s3Log.Debugf("%v = %v", k, v)
}
}
if server != nil && server[0] == "AmazonS3" {
if s.flags.IsAws || (server != nil && server[0] == "AmazonS3") {
isAws = true
}

Expand Down
6 changes: 6 additions & 0 deletions internal/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ func NewApp() (app *cli.App) {
Usage: "Set Content-Type according to file extension and /etc/mime.types (default: off)",
},

cli.BoolFlag{
Name: "isAws",
Usage: "Enable v2 aws api (default: off)",
},

/// http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html
/// See http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html
cli.BoolFlag{
Expand Down Expand Up @@ -335,6 +340,7 @@ func PopulateFlags(c *cli.Context) (ret *FlagStorage) {

// Common Backend Config
Endpoint: c.String("endpoint"),
IsAws: c.Bool("isAws"),
UseContentType: c.Bool("use-content-type"),

// Debugging,
Expand Down