Skip to content

Commit

Permalink
connector: customendpoint bool for NewAWSReader
Browse files Browse the repository at this point in the history
Workaround to use min.io or other compatible service as s3 backend
Set customEndpoint = true  to indicate that we are not using
aws services.
  • Loading branch information
talset committed May 5, 2020
1 parent c86b87c commit 69c5eeb
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ import (

//go:generate go run ./cmd/ -output generate.go

// Define CustomEndpoint if you are using custom endpoint like min.io.
// Set true to indicate that we are not using aws services
var CustomEndpoint bool = false

// NewAWSReader returns an object which also contains the accountID and extend the different regions to use.
//
// The accountID is helpful to return only the AMI or snapshots that belong to the account.
Expand Down Expand Up @@ -59,11 +63,16 @@ func NewAWSReader(
return nil, err
}
c.creds = creds
if err := c.setAccountID(ctx, sts); err != nil {
return nil, err
}
if err := c.setRegions(ctx, ec2s, regions); err != nil {
return nil, err

if customEndpoint {
c.regions = regions
} else {
if err := c.setAccountID(ctx, sts); err != nil {
return nil, err
}
if err := c.setRegions(ctx, ec2s, regions); err != nil {
return nil, err
}
}
c.setServices(config)
return &c, nil
Expand Down

0 comments on commit 69c5eeb

Please sign in to comment.