Skip to content

Commit

Permalink
update README, save some indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
m90 committed Oct 28, 2021
1 parent 7f0f173 commit 5245b58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ You can populate below template according to your requirements and use it as you

# Setting this variable to `true` will disable verification of
# SSL certificates. You shouldn't use this unless you use self-signed
# certificates for your remote storage backend.
# certificates for your remote storage backend. This can only be used
# when AWS_ENDPOINT_PROTO is set to `https`.

# AWS_ENDPOINT_INSECURE="true"

Expand Down
18 changes: 10 additions & 8 deletions cmd/backup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,21 +159,23 @@ func newScript() (*script, error) {
} else {
return nil, errors.New("newScript: AWS_S3_BUCKET_NAME is defined, but no credentials were provided")
}

options := minio.Options{
Creds: creds,
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 {
if !options.Secure {
return nil, errors.New("newScript: AWS_ENDPOINT_INSECURE = true is only meaningful for https")
}

transport, err := minio.DefaultTransport(true)
if err != nil {
return nil, fmt.Errorf("newScript: failed to create default minio transport")
}
transport.TLSClientConfig.InsecureSkipVerify = true
options.Transport = transport
}

mc, err := minio.New(s.c.AwsEndpoint, &options)
Expand Down

0 comments on commit 5245b58

Please sign in to comment.