Skip to content

Commit

Permalink
Merge pull request #92 from ApsOps/iam-role-fix
Browse files Browse the repository at this point in the history
Fix for using EC2 IAM credentials for S3 access
  • Loading branch information
mboersma authored May 25, 2017
2 parents 0d3081b + 067e622 commit ad1412c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@ func main() {
log.Fatal(err)
} else {
os.Setenv("REGISTRY_STORAGE_S3_ACCESSKEY", string(accesskey))
os.Setenv("AWS_ACCESS_KEY_ID", string(accesskey))
if len(accesskey) != 0 {
os.Setenv("AWS_ACCESS_KEY_ID", string(accesskey))
}
}

if secretkey, err := ioutil.ReadFile("/var/run/secrets/deis/registry/creds/secretkey"); err != nil {
log.Fatal(err)
} else {
os.Setenv("REGISTRY_STORAGE_S3_SECRETKEY", string(secretkey))
os.Setenv("AWS_SECRET_ACCESS_KEY", string(secretkey))
if len(secretkey) != 0 {
os.Setenv("AWS_SECRET_ACCESS_KEY", string(secretkey))
}
}

if region, err := ioutil.ReadFile("/var/run/secrets/deis/registry/creds/region"); err != nil {
Expand Down

0 comments on commit ad1412c

Please sign in to comment.