update README, save some indentation

This commit is contained in:
Frederik Ring 2021-10-28 19:55:39 +02:00
parent 7f0f173115
commit 5245b5882f
2 changed files with 12 additions and 9 deletions

View File

@ -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 # Setting this variable to `true` will disable verification of
# SSL certificates. You shouldn't use this unless you use self-signed # 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" # AWS_ENDPOINT_INSECURE="true"

View File

@ -159,21 +159,23 @@ 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{ options := minio.Options{
Creds: creds, Creds: creds,
Secure: s.c.AwsEndpointProto == "https", Secure: s.c.AwsEndpointProto == "https",
} }
if s.c.AwsEndpointInsecure { if s.c.AwsEndpointInsecure {
if options.Secure { if !options.Secure {
transport, err := minio.DefaultTransport(options.Secure) return nil, errors.New("newScript: AWS_ENDPOINT_INSECURE = true is only meaningful for https")
}
transport, err := minio.DefaultTransport(true)
if err != nil { if err != nil {
return nil, fmt.Errorf("newScript: failed to create default minio transport") return nil, fmt.Errorf("newScript: failed to create default minio transport")
} }
transport.TLSClientConfig.InsecureSkipVerify = true transport.TLSClientConfig.InsecureSkipVerify = true
options.Transport = transport 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) mc, err := minio.New(s.c.AwsEndpoint, &options)