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

storage: use anonymous credentials when ak sk is empty #64

Merged
merged 1 commit into from
Oct 11, 2023
Merged
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
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
Loading