Skip to content
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@ For the usage with a AWS S3 Bucket, you just need to specify the following optio

If you specify the s3-region, you don't need to set the endpoint URL since the correct endpoint will used automatically.

If you don't explicitly specify the aws-access-key and aws-secret-key, the AWS default credential provider chain is used. so support:
- Shared credentials/config files (~/.aws/credentials, ~/.aws/config)
- EC2/ECS instance roles
- EKS Pod Identity

<br />

### Custom S3 providers
Expand Down
8 changes: 3 additions & 5 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,9 @@ func New() *Cmd {

switch provider := c.String("provider"); provider {
case "s3":
if accessKey := c.String("aws-access-key"); accessKey == "" {
return errors.New("access-key not set.")
} else if secretKey := c.String("aws-secret-key"); secretKey == "" {
return errors.New("secret-key not set.")
} else if bucket := c.String("bucket"); bucket == "" {
accessKey := c.String("aws-access-key")
secretKey := c.String("aws-secret-key")
if bucket := c.String("bucket"); bucket == "" {
return errors.New("bucket not set.")
} else if store, err := storage.NewS3Storage(c.Context, accessKey, secretKey, bucket, purgeDays, c.String("s3-region"), c.String("s3-endpoint"), c.Bool("s3-no-multipart"), c.Bool("s3-path-style"), logger); err != nil {
return err
Expand Down
3 changes: 3 additions & 0 deletions server/storage/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ func (s *S3Storage) Put(ctx context.Context, token string, filename string, read
func (s *S3Storage) IsRangeSupported() bool { return true }

func getAwsConfig(ctx context.Context, accessKey, secretKey string) (aws.Config, error) {
if accessKey == "" || secretKey == "" {
return config.LoadDefaultConfig(ctx)
}
return config.LoadDefaultConfig(ctx,
config.WithCredentialsProvider(credentials.StaticCredentialsProvider{
Value: aws.Credentials{
Expand Down