Skip to content

Commit

Permalink
chore(vdp): add uploading URL logger and skip TLS verification (#28)
Browse files Browse the repository at this point in the history
Because

- the logger is not clear

This commit

- add the logger
- skip TLS verification for blobstorage

---------

Co-authored-by: Chang, Hui-Tang <[email protected]>
  • Loading branch information
chuang8511 and donch1989 authored Nov 19, 2024
1 parent 36280f1 commit e4a78ca
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion blobstorage/blobstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package blobstorage
import (
"bytes"
"context"
"crypto/tls"
"fmt"
"io"
"net/http"
Expand All @@ -28,7 +29,11 @@ func UploadFile(ctx context.Context, logger *zap.Logger, uploadURL string, data
req.Header.Set("Content-Type", contentType)
req.Header.Del("Authorization")

client := &http.Client{}
client := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
}
resp, err := client.Do(req)

if err != nil {
Expand All @@ -42,6 +47,7 @@ func UploadFile(ctx context.Context, logger *zap.Logger, uploadURL string, data
logger.Error("Failed to upload file to MinIO",
zap.Binary("body", body),
zap.Int("status", resp.StatusCode),
zap.String("Uploading URL", uploadURL),
zap.Error(err),
)
return err
Expand Down

0 comments on commit e4a78ca

Please sign in to comment.