🤬
  • ■ ■ ■ ■ ■
    pkg/cloud_storage/client/minio.go
    skipped 1 lines
    2 2   
    3 3  import (
    4 4   "context"
     5 + "crypto/tls"
    5 6   "errors"
    6 7   "github.com/minio/minio-go/v7"
    7 8   "github.com/minio/minio-go/v7/pkg/credentials"
    8 9   "io"
     10 + "net/http"
    9 11   "os"
    10 12  )
    11 13   
    skipped 6 lines
    18 20   var endpoint string
    19 21   var accessKeyID string
    20 22   var secretAccessKey string
     23 + var ssl string
    21 24   if _, ok := vars["endpoint"]; ok {
    22 25   endpoint = vars["endpoint"].(string)
    23 26   } else {
    skipped 10 lines
    34 37   return nil, errors.New(ParamEmpty)
    35 38   }
    36 39   
     40 + if _, ok := vars["ssl"]; ok {
     41 + ssl = vars["ssl"].(string)
     42 + } else {
     43 + return nil, errors.New(ParamEmpty)
     44 + }
     45 + secure := false
     46 + tlsConfig := &tls.Config{}
     47 + if ssl == "https" {
     48 + secure = true
     49 + tlsConfig.InsecureSkipVerify = true
     50 + }
     51 + var transport http.RoundTripper = &http.Transport{
     52 + TLSClientConfig: tlsConfig,
     53 + }
    37 54   client, err := minio.New(endpoint, &minio.Options{
    38  - Creds: credentials.NewStaticV4(accessKeyID, secretAccessKey, ""),
    39  - Secure: false,
     55 + Creds: credentials.NewStaticV4(accessKeyID, secretAccessKey, ""),
     56 + Secure: secure,
     57 + Transport: transport,
    40 58   })
    41 59   if err != nil {
    42 60   return nil, err
    skipped 99 lines
Please wait...
Page is in error, reload to recover