Skip to content

Commit

Permalink
use sts cred from env
Browse files Browse the repository at this point in the history
  • Loading branch information
mozillazg committed May 17, 2023
1 parent 1ba9b4f commit 1c72969
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ci/ossutil/main.go
Expand Up @@ -4,6 +4,7 @@ import (
"flag"
"fmt"
"log"
"os"
"path"
"time"

Expand Down Expand Up @@ -52,7 +53,12 @@ func (p *ossCredentialsProvider) GetCredentials() oss.Credentials {
}

func NewClient(endpoint string) (*oss.Client, error) {
cred, err := credentials.NewCredential(nil)
cred, err := credentials.NewCredential(&credentials.Config{
Type: tea.String("sts"),
AccessKeyId: tea.String(os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_ID")),
AccessKeySecret: tea.String(os.Getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET")),
SecurityToken: tea.String(os.Getenv("ALIBABA_CLOUD_SECURITY_TOKEN")),
})
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 1c72969

Please sign in to comment.