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

Commit

Permalink
storage: use anonymous credentials when ak sk is empty
Browse files Browse the repository at this point in the history
Signed-off-by: huanghaoyuan <[email protected]>
  • Loading branch information
huanghaoyuanhhy committed Oct 11, 2023
1 parent ed33a98 commit 79ed44c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion storage/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ func NewS3Client(cfg Cfg) (*S3Client, error) {
}

if !cfg.UseIAM {
awsCfg.Credentials = credentials.NewStaticCredentialsProvider(cfg.AK, cfg.SK, "")
if len(cfg.AK) != 0 && len(cfg.SK) != 0 {
awsCfg.Credentials = credentials.NewStaticCredentialsProvider(cfg.AK, cfg.SK, "")
} else {
awsCfg.Credentials = aws.AnonymousCredentials{}
}
}
return &S3Client{cli: s3.NewFromConfig(awsCfg)}, nil
}
Expand Down

0 comments on commit 79ed44c

Please sign in to comment.