mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-10 08:55:45 +08:00
adding option to skip tls verification error (#30)
* adding option to skip tls verification error * merge options * removed merged option from README Co-authored-by: Schwannden Kuo <schwannden@mobagel.com>
This commit is contained in:
parent
ad7ec58322
commit
7f0f173115
1 changed files with 17 additions and 4 deletions
|
@ -159,11 +159,24 @@ func newScript() (*script, error) {
|
|||
} else {
|
||||
return nil, errors.New("newScript: AWS_S3_BUCKET_NAME is defined, but no credentials were provided")
|
||||
}
|
||||
|
||||
mc, err := minio.New(s.c.AwsEndpoint, &minio.Options{
|
||||
options := minio.Options{
|
||||
Creds: creds,
|
||||
Secure: !s.c.AwsEndpointInsecure && s.c.AwsEndpointProto == "https",
|
||||
})
|
||||
Secure: s.c.AwsEndpointProto == "https",
|
||||
}
|
||||
if s.c.AwsEndpointInsecure {
|
||||
if options.Secure {
|
||||
transport, err := minio.DefaultTransport(options.Secure)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("newScript: failed to create default minio transport")
|
||||
}
|
||||
transport.TLSClientConfig.InsecureSkipVerify = true
|
||||
options.Transport = transport
|
||||
} else {
|
||||
return nil, errors.New("newScript: AWS_ENDPOINT_INSECURE = true is only meaningful for https")
|
||||
}
|
||||
}
|
||||
|
||||
mc, err := minio.New(s.c.AwsEndpoint, &options)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("newScript: error setting up minio client: %w", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue