Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
Use URI, not Endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jadudm committed Mar 5, 2024
1 parent 3b94d7d commit d158dbd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/pipes/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func S3(in_pipe *script.Pipe,
"s3",
"cp",
"--endpoint-url",
up.Endpoint,
up.Uri,
"-",
fmt.Sprintf("s3://%s/backups/%s-%s_%s.dump",
up.Bucket,
Expand Down
21 changes: 20 additions & 1 deletion internal/vcap/vcap.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package vcap

import (
"bytes"
"fmt"
"os"

"golang.org/x/exp/slices"
Expand Down Expand Up @@ -66,7 +67,25 @@ func GetS3Credentials(name string) (*structs.CredentialsS3, error) {
}
for _, instance := range instanceSlice {
if instance.Name == name {
return &instance.Credentials, nil
all_looks_good := false

// We have to have an endpoint, or the two key bits.
if (len(instance.Credentials.AccessKeyId) > 0) &&
(len(instance.Credentials.SecretAccessKey) > 0) {
all_looks_good = true
} else if len(instance.Credentials.Uri) > 0 {
all_looks_good = true
}

if len(instance.Credentials.Region) < 1 {
logging.Logger.Println("BACKUPS region is empty")
os.Exit(-1)
}
if all_looks_good {
return &instance.Credentials, nil
} else {
return nil, fmt.Errorf("BACKUPS no access key or endpoint")
}
}
}

Expand Down

0 comments on commit d158dbd

Please sign in to comment.