mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-22 05:10:28 +01: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
@ -159,11 +159,24 @@ func newScript() (*script, error) {
|
|||||||
} else {
|
} else {
|
||||||
return nil, errors.New("newScript: AWS_S3_BUCKET_NAME is defined, but no credentials were provided")
|
return nil, errors.New("newScript: AWS_S3_BUCKET_NAME is defined, but no credentials were provided")
|
||||||
}
|
}
|
||||||
|
options := minio.Options{
|
||||||
mc, err := minio.New(s.c.AwsEndpoint, &minio.Options{
|
|
||||||
Creds: creds,
|
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 {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("newScript: error setting up minio client: %w", err)
|
return nil, fmt.Errorf("newScript: error setting up minio client: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user