Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Jul 25, 2023
1 parent a6d00c4 commit 9bc50f7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions providers/http/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"strings"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/go-acme/lego/v4/challenge/http01"
Expand Down Expand Up @@ -46,8 +47,8 @@ func (s *HTTPProvider) Present(domain, token, keyAuth string) error {

params := &s3.PutObjectInput{
ACL: "public-read",
Bucket: pointer(s.bucket),
Key: pointer(strings.Trim(http01.ChallengePath(token), "/")),
Bucket: aws.String(s.bucket),
Key: aws.String(strings.Trim(http01.ChallengePath(token), "/")),
Body: bytes.NewReader([]byte(keyAuth)),
}

Expand All @@ -63,8 +64,8 @@ func (s *HTTPProvider) CleanUp(domain, token, keyAuth string) error {
ctx := context.Background()

params := &s3.DeleteObjectInput{
Bucket: pointer(s.bucket),
Key: pointer(strings.Trim(http01.ChallengePath(token), "/")),
Bucket: aws.String(s.bucket),
Key: aws.String(strings.Trim(http01.ChallengePath(token), "/")),
}

_, err := s.client.DeleteObject(ctx, params)
Expand All @@ -74,5 +75,3 @@ func (s *HTTPProvider) CleanUp(domain, token, keyAuth string) error {

return nil
}

func pointer[T string | int | int32 | int64](v T) *T { return &v }

0 comments on commit 9bc50f7

Please sign in to comment.