Skip to content

Commit

Permalink
Allow AWS Cred Chain
Browse files Browse the repository at this point in the history
  • Loading branch information
tybritten committed Aug 2, 2022
1 parent 457bba7 commit e447757
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions archives/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ func NewDefaultConfig() *Config {
S3DisableSSL: false,
S3ForcePathStyle: false,

AWSAccessKeyID: "missing_aws_access_key_id",
AWSSecretAccessKey: "missing_aws_secret_access_key",
AWSAccessKeyID: "",
AWSSecretAccessKey: "",

TempDir: "/tmp",
KeepFiles: false,
Expand Down
9 changes: 6 additions & 3 deletions archives/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ var s3BucketURL = "https://%s.s3.amazonaws.com%s"

// NewS3Client creates a new s3 client from the passed in config, testing it as necessary
func NewS3Client(config *Config) (s3iface.S3API, error) {
s3Session, err := session.NewSession(&aws.Config{
Credentials: credentials.NewStaticCredentials(config.AWSAccessKeyID, config.AWSSecretAccessKey, ""),
s3config := &aws.Config{
Endpoint: aws.String(config.S3Endpoint),
Region: aws.String(config.S3Region),
DisableSSL: aws.Bool(config.S3DisableSSL),
S3ForcePathStyle: aws.Bool(config.S3ForcePathStyle),
})
}
if config.AWSAccessKeyID != "" {
s3config.Credentials = credentials.NewStaticCredentials(config.AWSAccessKeyID, config.AWSSecretAccessKey, "")
}
s3Session, err := session.NewSession(s3config)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/jmoiron/sqlx v1.3.5
github.com/lib/pq v1.10.6
github.com/nyaruka/ezconf v0.2.1
github.com/nyaruka/gocommon v1.22.4
github.com/nyaruka/gocommon v1.24.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.8.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ github.com/naoina/toml v0.1.1 h1:PT/lllxVVN0gzzSqSlHEmP8MJB4MY2U7STGxiouV4X8=
github.com/naoina/toml v0.1.1/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E=
github.com/nyaruka/ezconf v0.2.1 h1:TDXWoqjqYya1uhou1mAJZg7rgFYL98EB0Tb3+BWtUh0=
github.com/nyaruka/ezconf v0.2.1/go.mod h1:ey182kYkw2MIi4XiWe1FR/mzI33WCmTWuceDYYxgnQw=
github.com/nyaruka/gocommon v1.22.4 h1:NCAItnrQbXlipDeOszoYbjXEFa1J1M+alS8VSk/uero=
github.com/nyaruka/gocommon v1.22.4/go.mod h1:g6/d9drZXDUrtRSPe2Kf8lTUS+baHt/0G0dwHq3qeIU=
github.com/nyaruka/gocommon v1.24.0 h1:zfluRa4h+Ms3hmed2vPov+PR/vWxtrTgBUEONRuuiIQ=
github.com/nyaruka/gocommon v1.24.0/go.mod h1:g6/d9drZXDUrtRSPe2Kf8lTUS+baHt/0G0dwHq3qeIU=
github.com/nyaruka/librato v1.0.0 h1:Vznj9WCeC1yZXbBYyYp40KnbmXLbEkjKmHesV/v2SR0=
github.com/nyaruka/librato v1.0.0/go.mod h1:pkRNLFhFurOz0QqBz6/DuTFhHHxAubWxs4Jx+J7yUgg=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down

0 comments on commit e447757

Please sign in to comment.